Mercurial > hg > orthanc-stone
annotate UnitTestsSources/UnitTestsMain.cpp @ 1874:08f2476e8f5e
added classes OrientedIntegerLine2D and RectanglesIntegerProjection
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Jan 2022 18:58:37 +0100 |
parents | 7053b8a0aaec |
children |
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 |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
47 | 9 * modify it under the terms of the GNU Affero General Public License |
10 * as published by the Free Software Foundation, either version 3 of | |
11 * the License, or (at your option) any later version. | |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * 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
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
47 | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Affero General Public License for more details. | |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
17 * |
47 | 18 * 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
|
19 * 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
|
20 **/ |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1413
diff
changeset
|
23 #include <gtest/gtest.h> |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
25 #include "../OrthancStone/Sources/StoneEnumerations.h" |
1587 | 26 #include "../OrthancStone/Sources/StoneInitialization.h" |
162
77715c340767
unit testing FiniteProjectiveCamera
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
161
diff
changeset
|
27 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
28 #include <Logging.h> |
163
8c5b24892ed2
LinearAlgebra::InvertMatrix
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
162
diff
changeset
|
29 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
30 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
31 # include <emscripten.h> |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
32 #endif |
689
93a8949a1ef7
VolumeImageGeometry::DetectSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
685
diff
changeset
|
33 |
1630
78509230f0d7
SortedFrames sharing code with CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
34 |
78509230f0d7
SortedFrames sharing code with CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
35 |
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
|
36 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
|
37 { |
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 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
|
39 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
|
40 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
|
41 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
|
42 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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 |
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_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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
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 |
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
|
58 |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 int main(int argc, char **argv) |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 { |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
61 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
62 std::string output; |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
63 #endif |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
64 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
65 int result; |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
66 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
67 { |
1680
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
68 OrthancStone::StoneInitialize(); |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
69 Orthanc::Logging::EnableInfoLevel(true); |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
71 ::testing::InitGoogleTest(&argc, argv); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
72 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
73 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
74 ::testing::internal::CaptureStdout(); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
75 #endif |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
76 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
77 result = RUN_ALL_TESTS(); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
78 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
79 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
80 output = testing::internal::GetCapturedStdout(); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
81 #endif |
1680
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
82 |
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
83 OrthancStone::StoneFinalize(); |
1679
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 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
86 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
87 EM_ASM({ |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
88 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
|
89 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
|
90 }, |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
91 output.c_str()); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
92 #endif |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 return result; |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 } |