Mercurial > hg > orthanc
annotate UnitTestsSources/Versions.cpp @ 812:8a36c947490c
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 08 May 2014 14:51:49 +0200 |
parents | a6576b478553 |
children | 3d6f9b7d0add |
rev | line source |
---|---|
0 | 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> | |
181
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
10 #include <sqlite3.h> |
382 | 11 #include <lua.h> |
748
de9763f63510
upgrade to openssl-1.0.1g because of heartbeat exploit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
12 #include <openssl/opensslv.h> |
0 | 13 |
14 | |
15 TEST(Versions, Zlib) | |
16 { | |
17 ASSERT_STREQ(zlibVersion(), ZLIB_VERSION); | |
18 } | |
19 | |
20 TEST(Versions, Curl) | |
21 { | |
22 curl_version_info_data* v = curl_version_info(CURLVERSION_NOW); | |
23 ASSERT_STREQ(LIBCURL_VERSION, v->version); | |
24 } | |
25 | |
26 TEST(Versions, Png) | |
27 { | |
28 ASSERT_EQ(PNG_LIBPNG_VER_MAJOR * 10000 + PNG_LIBPNG_VER_MINOR * 100 + PNG_LIBPNG_VER_RELEASE, | |
29 png_access_version_number()); | |
30 } | |
31 | |
181
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
32 TEST(Versions, SQLite) |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
33 { |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
34 // http://www.sqlite.org/capi3ref.html#sqlite3_libversion |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
35 assert(sqlite3_libversion_number() == SQLITE_VERSION_NUMBER ); |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
36 assert(strcmp(sqlite3_sourceid(), SQLITE_SOURCE_ID) == 0); |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
37 assert(strcmp(sqlite3_libversion(), SQLITE_VERSION) == 0); |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
38 |
194
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
39 // Ensure that the SQLite version is above 3.7.0. |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
40 // "sqlite3_create_function_v2" is not defined in previous versions. |
181
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
41 ASSERT_GE(SQLITE_VERSION_NUMBER, 3007000); |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
42 } |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
43 |
0 | 44 |
382 | 45 TEST(Versions, Lua) |
46 { | |
47 // Ensure that the Lua version is above 5.1.0. This version has | |
48 // introduced some API changes. | |
49 ASSERT_GE(LUA_VERSION_NUM, 501); | |
50 } | |
51 | |
52 | |
63 | 53 #if ORTHANC_STATIC == 1 |
0 | 54 TEST(Versions, ZlibStatic) |
55 { | |
56 ASSERT_STREQ("1.2.7", zlibVersion()); | |
57 } | |
58 | |
59 TEST(Versions, BoostStatic) | |
60 { | |
753
a6576b478553
upgrade to boost 1.55.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
748
diff
changeset
|
61 ASSERT_STREQ("1_55", BOOST_LIB_VERSION); |
0 | 62 } |
63 | |
64 TEST(Versions, CurlStatic) | |
65 { | |
66 curl_version_info_data* v = curl_version_info(CURLVERSION_NOW); | |
67 ASSERT_STREQ("7.26.0", v->version); | |
68 } | |
69 | |
70 TEST(Versions, PngStatic) | |
71 { | |
72 ASSERT_EQ(10512, png_access_version_number()); | |
73 ASSERT_STREQ("1.5.12", PNG_LIBPNG_VER_STRING); | |
74 } | |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
75 |
382 | 76 TEST(Versions, CurlSslStatic) |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
77 { |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
78 curl_version_info_data * vinfo = curl_version_info(CURLVERSION_NOW); |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
79 |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
80 // Check that SSL support is enabled when required |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
81 bool curlSupportsSsl = vinfo->features & CURL_VERSION_SSL; |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
82 |
63 | 83 #if ORTHANC_SSL_ENABLED == 0 |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
84 ASSERT_FALSE(curlSupportsSsl); |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
85 #else |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
86 ASSERT_TRUE(curlSupportsSsl); |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
87 #endif |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
88 } |
382 | 89 |
90 TEST(Version, LuaStatic) | |
91 { | |
92 ASSERT_STREQ("Lua 5.1.5", LUA_RELEASE); | |
93 } | |
748
de9763f63510
upgrade to openssl-1.0.1g because of heartbeat exploit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
94 |
de9763f63510
upgrade to openssl-1.0.1g because of heartbeat exploit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
95 TEST(Version, OpenSslStatic) |
de9763f63510
upgrade to openssl-1.0.1g because of heartbeat exploit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
96 { |
de9763f63510
upgrade to openssl-1.0.1g because of heartbeat exploit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
97 ASSERT_EQ(0x1000107fL /* openssl-1.0.1g */, OPENSSL_VERSION_NUMBER); |
de9763f63510
upgrade to openssl-1.0.1g because of heartbeat exploit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
98 } |
de9763f63510
upgrade to openssl-1.0.1g because of heartbeat exploit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
99 |
37 | 100 #endif |