annotate UnitTestsSources/UnitTestsMain.cpp @ 1868:87de32ac3ea7

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Jan 2022 10:45:58 +0100
parents 9ac2a65d4172
children 3889ae96d2e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
10 * the License, or (at your option) any later version.
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
15 * Affero General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1591
diff changeset
16 *
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1413
diff changeset
22 #include <gtest/gtest.h>
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
24 #include "../OrthancStone/Sources/StoneEnumerations.h"
1587
a1405ab3a91c reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1541
diff changeset
25 #include "../OrthancStone/Sources/StoneInitialization.h"
162
77715c340767 unit testing FiniteProjectiveCamera
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 161
diff changeset
26
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
27 #include <Logging.h>
163
8c5b24892ed2 LinearAlgebra::InvertMatrix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 162
diff changeset
28
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
29 #if defined(__EMSCRIPTEN__)
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
30 # include <emscripten.h>
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
31 #endif
689
93a8949a1ef7 VolumeImageGeometry::DetectSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 685
diff changeset
32
1630
78509230f0d7 SortedFrames sharing code with CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
33
78509230f0d7 SortedFrames sharing code with CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
34
1665
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
35 TEST(Enumerations, Basic)
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
36 {
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
37 using namespace OrthancStone;
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
38 ASSERT_EQ(SopClassUid_EncapsulatedPdf, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.104.1"));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
39 ASSERT_EQ(SopClassUid_RTStruct, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.481.3"));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
40 ASSERT_EQ(SopClassUid_RTDose, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.481.2"));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
41 ASSERT_EQ(SopClassUid_RTPlan, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.481.5"));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
42 ASSERT_EQ(SopClassUid_VideoEndoscopicImageStorage, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.77.1.1.1"));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
43 ASSERT_EQ(SopClassUid_VideoMicroscopicImageStorage, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.77.1.2.1"));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
44 ASSERT_EQ(SopClassUid_VideoPhotographicImageStorage, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.77.1.4.1"));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
45 ASSERT_EQ(SopClassUid_Other, StringToSopClassUid("nope"));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
46
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
47 ASSERT_EQ(SeriesThumbnailType_Pdf, GetSeriesThumbnailType(SopClassUid_EncapsulatedPdf));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
48 ASSERT_EQ(SeriesThumbnailType_Video, GetSeriesThumbnailType(SopClassUid_VideoEndoscopicImageStorage));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
49 ASSERT_EQ(SeriesThumbnailType_Video, GetSeriesThumbnailType(SopClassUid_VideoMicroscopicImageStorage));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
50 ASSERT_EQ(SeriesThumbnailType_Video, GetSeriesThumbnailType(SopClassUid_VideoPhotographicImageStorage));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
51 ASSERT_EQ(SeriesThumbnailType_Unsupported, GetSeriesThumbnailType(SopClassUid_Other));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
52 ASSERT_EQ(SeriesThumbnailType_Unsupported, GetSeriesThumbnailType(SopClassUid_RTDose));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
53 ASSERT_EQ(SeriesThumbnailType_Unsupported, GetSeriesThumbnailType(SopClassUid_RTStruct));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
54 ASSERT_EQ(SeriesThumbnailType_Unsupported, GetSeriesThumbnailType(SopClassUid_RTPlan));
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
55 }
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
56
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1650
diff changeset
57
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 int main(int argc, char **argv)
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 {
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
60 #if defined(__EMSCRIPTEN__)
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
61 std::string output;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
62 #endif
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
63
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
64 int result;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
65
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
66 {
1680
03afa09cfcf1 running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
67 OrthancStone::StoneInitialize();
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
68 Orthanc::Logging::EnableInfoLevel(true);
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
70 ::testing::InitGoogleTest(&argc, argv);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
71
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
72 #if defined(__EMSCRIPTEN__)
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
73 ::testing::internal::CaptureStdout();
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
74 #endif
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
75
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
76 result = RUN_ALL_TESTS();
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
77
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
78 #if defined(__EMSCRIPTEN__)
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
79 output = testing::internal::GetCapturedStdout();
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
80 #endif
1680
03afa09cfcf1 running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
81
03afa09cfcf1 running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
82 OrthancStone::StoneFinalize();
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
83 }
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
84
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
85 #if defined(__EMSCRIPTEN__)
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
86 EM_ASM({
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
87 document.getElementById("output").innerHTML = UTF8ToString($0);
1680
03afa09cfcf1 running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
88 window.scrollTo(0, document.body.scrollHeight); // Scroll to the end of the page
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
89 },
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
90 output.c_str());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
91 #endif
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 return result;
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 }