Mercurial > hg > orthanc
annotate UnitTests/Versions.cpp @ 226:8a26a8e85edf
refactoring to read files
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 30 Nov 2012 09:45:29 +0100 |
parents | 0186ac92810c |
children | b45bc565d82a |
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> |
0 | 11 |
12 | |
13 TEST(Versions, Zlib) | |
14 { | |
15 ASSERT_STREQ(zlibVersion(), ZLIB_VERSION); | |
16 } | |
17 | |
18 TEST(Versions, Curl) | |
19 { | |
20 curl_version_info_data* v = curl_version_info(CURLVERSION_NOW); | |
21 ASSERT_STREQ(LIBCURL_VERSION, v->version); | |
22 } | |
23 | |
24 TEST(Versions, Png) | |
25 { | |
26 ASSERT_EQ(PNG_LIBPNG_VER_MAJOR * 10000 + PNG_LIBPNG_VER_MINOR * 100 + PNG_LIBPNG_VER_RELEASE, | |
27 png_access_version_number()); | |
28 } | |
29 | |
181
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
30 TEST(Versions, SQLite) |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
31 { |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
32 // http://www.sqlite.org/capi3ref.html#sqlite3_libversion |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
33 assert(sqlite3_libversion_number() == SQLITE_VERSION_NUMBER ); |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
34 assert(strcmp(sqlite3_sourceid(), SQLITE_SOURCE_ID) == 0); |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
35 assert(strcmp(sqlite3_libversion(), SQLITE_VERSION) == 0); |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
36 |
194
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
181
diff
changeset
|
37 // 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
|
38 // "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
|
39 ASSERT_GE(SQLITE_VERSION_NUMBER, 3007000); |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
40 } |
2dece1526c06
simplifying db schema
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
41 |
0 | 42 |
63 | 43 #if ORTHANC_STATIC == 1 |
0 | 44 TEST(Versions, ZlibStatic) |
45 { | |
46 ASSERT_STREQ("1.2.7", zlibVersion()); | |
47 } | |
48 | |
49 TEST(Versions, BoostStatic) | |
50 { | |
8 | 51 ASSERT_STREQ("1_49", BOOST_LIB_VERSION); |
0 | 52 } |
53 | |
54 TEST(Versions, CurlStatic) | |
55 { | |
56 curl_version_info_data* v = curl_version_info(CURLVERSION_NOW); | |
57 ASSERT_STREQ("7.26.0", v->version); | |
58 } | |
59 | |
60 TEST(Versions, PngStatic) | |
61 { | |
62 ASSERT_EQ(10512, png_access_version_number()); | |
63 ASSERT_STREQ("1.5.12", PNG_LIBPNG_VER_STRING); | |
64 } | |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
65 |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
66 TEST(Versions, CurlSsl) |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
67 { |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
68 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
|
69 |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
70 // Check that SSL support is enabled when required |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
71 bool curlSupportsSsl = vinfo->features & CURL_VERSION_SSL; |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
72 |
63 | 73 #if ORTHANC_SSL_ENABLED == 0 |
29
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
74 ASSERT_FALSE(curlSupportsSsl); |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
75 #else |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
76 ASSERT_TRUE(curlSupportsSsl); |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
77 #endif |
042ac60f5bf9
simplified build of curl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
8
diff
changeset
|
78 } |
37 | 79 #endif |