comparison UnitTestsSources/Versions.cpp @ 632:17815b9d4280

rename the UnitTests directory to avoid clashes in filenames
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 28 Oct 2013 16:26:51 +0100
parents UnitTests/Versions.cpp@938d8461cf8f
children de9763f63510
comparison
equal deleted inserted replaced
631:fc6ad5b97219 632:17815b9d4280
1 #include "gtest/gtest.h"
2
3 #include <stdint.h>
4 #include <math.h>
5 #include <png.h>
6 #include <ctype.h>
7 #include <zlib.h>
8 #include <curl/curl.h>
9 #include <boost/version.hpp>
10 #include <sqlite3.h>
11 #include <lua.h>
12
13
14 TEST(Versions, Zlib)
15 {
16 ASSERT_STREQ(zlibVersion(), ZLIB_VERSION);
17 }
18
19 TEST(Versions, Curl)
20 {
21 curl_version_info_data* v = curl_version_info(CURLVERSION_NOW);
22 ASSERT_STREQ(LIBCURL_VERSION, v->version);
23 }
24
25 TEST(Versions, Png)
26 {
27 ASSERT_EQ(PNG_LIBPNG_VER_MAJOR * 10000 + PNG_LIBPNG_VER_MINOR * 100 + PNG_LIBPNG_VER_RELEASE,
28 png_access_version_number());
29 }
30
31 TEST(Versions, SQLite)
32 {
33 // http://www.sqlite.org/capi3ref.html#sqlite3_libversion
34 assert(sqlite3_libversion_number() == SQLITE_VERSION_NUMBER );
35 assert(strcmp(sqlite3_sourceid(), SQLITE_SOURCE_ID) == 0);
36 assert(strcmp(sqlite3_libversion(), SQLITE_VERSION) == 0);
37
38 // Ensure that the SQLite version is above 3.7.0.
39 // "sqlite3_create_function_v2" is not defined in previous versions.
40 ASSERT_GE(SQLITE_VERSION_NUMBER, 3007000);
41 }
42
43
44 TEST(Versions, Lua)
45 {
46 // Ensure that the Lua version is above 5.1.0. This version has
47 // introduced some API changes.
48 ASSERT_GE(LUA_VERSION_NUM, 501);
49 }
50
51
52 #if ORTHANC_STATIC == 1
53 TEST(Versions, ZlibStatic)
54 {
55 ASSERT_STREQ("1.2.7", zlibVersion());
56 }
57
58 TEST(Versions, BoostStatic)
59 {
60 ASSERT_STREQ("1_54", BOOST_LIB_VERSION);
61 }
62
63 TEST(Versions, CurlStatic)
64 {
65 curl_version_info_data* v = curl_version_info(CURLVERSION_NOW);
66 ASSERT_STREQ("7.26.0", v->version);
67 }
68
69 TEST(Versions, PngStatic)
70 {
71 ASSERT_EQ(10512, png_access_version_number());
72 ASSERT_STREQ("1.5.12", PNG_LIBPNG_VER_STRING);
73 }
74
75 TEST(Versions, CurlSslStatic)
76 {
77 curl_version_info_data * vinfo = curl_version_info(CURLVERSION_NOW);
78
79 // Check that SSL support is enabled when required
80 bool curlSupportsSsl = vinfo->features & CURL_VERSION_SSL;
81
82 #if ORTHANC_SSL_ENABLED == 0
83 ASSERT_FALSE(curlSupportsSsl);
84 #else
85 ASSERT_TRUE(curlSupportsSsl);
86 #endif
87 }
88
89 TEST(Version, LuaStatic)
90 {
91 ASSERT_STREQ("Lua 5.1.5", LUA_RELEASE);
92 }
93 #endif
94