Mercurial > hg > orthanc-databases
comparison Odbc/UnitTests/UnitTestsMain.cpp @ 329:b5fb8b77ce4d
initial commit of ODBC framework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Aug 2021 20:08:53 +0200 |
parents | |
children | 674bbb9d1c83 |
comparison
equal
deleted
inserted
replaced
328:6a49c495c940 | 329:b5fb8b77ce4d |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include "../Plugins/OdbcIndex.h" | |
23 | |
24 static std::string connectionString_; | |
25 | |
26 #include "../../Framework/Plugins/IndexUnitTests.h" | |
27 | |
28 #include <Logging.h> | |
29 | |
30 | |
31 #if defined(_WIN32) | |
32 # warning Strings have not been tested on Windows (UTF16 issues ahead)! | |
33 # include <windows.h> | |
34 #else | |
35 # include <ltdl.h> | |
36 # include <libltdl/lt_dlloader.h> | |
37 #endif | |
38 | |
39 | |
40 #if !defined(_WIN32) | |
41 extern "C" | |
42 { | |
43 extern lt_dlvtable *dlopen_LTX_get_vtable(lt_user_data loader_data); | |
44 } | |
45 #endif | |
46 | |
47 | |
48 int main(int argc, char **argv) | |
49 { | |
50 if (argc < 2) | |
51 { | |
52 std::cerr | |
53 << std::endl | |
54 << "Usage: " << argv[0] << " <connection string>" | |
55 << std::endl << std::endl | |
56 << "Example: " << argv[0] << " \"DSN=test\"" | |
57 << std::endl << std::endl; | |
58 return -1; | |
59 } | |
60 | |
61 for (int i = 1; i < argc; i++) | |
62 { | |
63 // Ignore arguments beginning with "-" to allow passing arguments | |
64 // to Google Test such as "--gtest_filter=" | |
65 if (argv[i] != NULL && | |
66 argv[i][0] != '-') | |
67 { | |
68 connectionString_ = argv[i]; | |
69 } | |
70 } | |
71 | |
72 #if !defined(_WIN32) | |
73 lt_dlinit(); | |
74 | |
75 /** | |
76 * The following call is necessary for "libltdl" to access the | |
77 * "dlopen()" primitives if statically linking. Otherwise, only the | |
78 * "preopen" primitives are available. | |
79 **/ | |
80 lt_dlloader_add(dlopen_LTX_get_vtable(NULL)); | |
81 #endif | |
82 | |
83 ::testing::InitGoogleTest(&argc, argv); | |
84 Orthanc::Logging::Initialize(); | |
85 Orthanc::Logging::EnableInfoLevel(true); | |
86 //Orthanc::Logging::EnableTraceLevel(true); | |
87 | |
88 int result = RUN_ALL_TESTS(); | |
89 | |
90 Orthanc::Logging::Finalize(); | |
91 | |
92 return result; | |
93 } |