Mercurial > hg > orthanc
comparison UnitTestsSources/VersionsTests.cpp @ 967:dfc076546821
add suffix Tests to unit test sources
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Jun 2014 15:36:38 +0200 |
parents | UnitTestsSources/Versions.cpp@84513f2ee1f3 |
children | 6e7e5ed91c2d |
comparison
equal
deleted
inserted
replaced
966:886652370ff2 | 967:dfc076546821 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege, | |
4 * Belgium | |
5 * | |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
22 * | |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
33 #include "PrecompiledHeadersUnitTests.h" | |
34 #include "gtest/gtest.h" | |
35 | |
36 #include <stdint.h> | |
37 #include <math.h> | |
38 #include <png.h> | |
39 #include <ctype.h> | |
40 #include <zlib.h> | |
41 #include <curl/curl.h> | |
42 #include <boost/version.hpp> | |
43 #include <sqlite3.h> | |
44 #include <lua.h> | |
45 #include <openssl/opensslv.h> | |
46 | |
47 | |
48 TEST(Versions, Zlib) | |
49 { | |
50 ASSERT_STREQ(zlibVersion(), ZLIB_VERSION); | |
51 } | |
52 | |
53 TEST(Versions, Curl) | |
54 { | |
55 curl_version_info_data* v = curl_version_info(CURLVERSION_NOW); | |
56 ASSERT_STREQ(LIBCURL_VERSION, v->version); | |
57 } | |
58 | |
59 TEST(Versions, Png) | |
60 { | |
61 ASSERT_EQ(PNG_LIBPNG_VER_MAJOR * 10000 + PNG_LIBPNG_VER_MINOR * 100 + PNG_LIBPNG_VER_RELEASE, | |
62 png_access_version_number()); | |
63 } | |
64 | |
65 TEST(Versions, SQLite) | |
66 { | |
67 // http://www.sqlite.org/capi3ref.html#sqlite3_libversion | |
68 assert(sqlite3_libversion_number() == SQLITE_VERSION_NUMBER ); | |
69 assert(strcmp(sqlite3_sourceid(), SQLITE_SOURCE_ID) == 0); | |
70 assert(strcmp(sqlite3_libversion(), SQLITE_VERSION) == 0); | |
71 | |
72 // Ensure that the SQLite version is above 3.7.0. | |
73 // "sqlite3_create_function_v2" is not defined in previous versions. | |
74 ASSERT_GE(SQLITE_VERSION_NUMBER, 3007000); | |
75 } | |
76 | |
77 | |
78 TEST(Versions, Lua) | |
79 { | |
80 // Ensure that the Lua version is above 5.1.0. This version has | |
81 // introduced some API changes. | |
82 ASSERT_GE(LUA_VERSION_NUM, 501); | |
83 } | |
84 | |
85 | |
86 #if ORTHANC_STATIC == 1 | |
87 TEST(Versions, ZlibStatic) | |
88 { | |
89 ASSERT_STREQ("1.2.7", zlibVersion()); | |
90 } | |
91 | |
92 TEST(Versions, BoostStatic) | |
93 { | |
94 ASSERT_STREQ("1_55", BOOST_LIB_VERSION); | |
95 } | |
96 | |
97 TEST(Versions, CurlStatic) | |
98 { | |
99 curl_version_info_data* v = curl_version_info(CURLVERSION_NOW); | |
100 ASSERT_STREQ("7.26.0", v->version); | |
101 } | |
102 | |
103 TEST(Versions, PngStatic) | |
104 { | |
105 ASSERT_EQ(10512, png_access_version_number()); | |
106 ASSERT_STREQ("1.5.12", PNG_LIBPNG_VER_STRING); | |
107 } | |
108 | |
109 TEST(Versions, CurlSslStatic) | |
110 { | |
111 curl_version_info_data * vinfo = curl_version_info(CURLVERSION_NOW); | |
112 | |
113 // Check that SSL support is enabled when required | |
114 bool curlSupportsSsl = vinfo->features & CURL_VERSION_SSL; | |
115 | |
116 #if ORTHANC_SSL_ENABLED == 0 | |
117 ASSERT_FALSE(curlSupportsSsl); | |
118 #else | |
119 ASSERT_TRUE(curlSupportsSsl); | |
120 #endif | |
121 } | |
122 | |
123 TEST(Version, LuaStatic) | |
124 { | |
125 ASSERT_STREQ("Lua 5.1.5", LUA_RELEASE); | |
126 } | |
127 | |
128 TEST(Version, OpenSslStatic) | |
129 { | |
130 ASSERT_EQ(0x1000107fL /* openssl-1.0.1g */, OPENSSL_VERSION_NUMBER); | |
131 } | |
132 | |
133 #endif |