Mercurial > hg > orthanc-stone
annotate OrthancStone/UnitTestsSources/UnitTestsMain.cpp @ 2117:48a7f05c3bd5 dicom-sr
integration mainline->dicom-sr
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 09 Mar 2024 10:01:30 +0100 |
parents | c23eef785569 |
children | 16c01cc201e7 |
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 |
2114
c23eef785569
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2094
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
c23eef785569
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2094
diff
changeset
|
6 * Copyright (C) 2021-2024 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 |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
47 | 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 |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
16 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
17 * |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
19 * License along with this program. If not, see |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
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 |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1413
diff
changeset
|
24 #include <gtest/gtest.h> |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
26 #include "../Sources/StoneEnumerations.h" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
27 #include "../Sources/StoneInitialization.h" |
162
77715c340767
unit testing FiniteProjectiveCamera
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
161
diff
changeset
|
28 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
29 #include <Logging.h> |
163
8c5b24892ed2
LinearAlgebra::InvertMatrix
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
162
diff
changeset
|
30 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
31 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
32 # include <emscripten.h> |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
33 #endif |
689
93a8949a1ef7
VolumeImageGeometry::DetectSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
685
diff
changeset
|
34 |
1630
78509230f0d7
SortedFrames sharing code with CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
35 |
78509230f0d7
SortedFrames sharing code with CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
36 |
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
|
37 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
|
38 { |
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 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
|
40 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
|
41 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
|
42 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
|
43 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
|
44 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
|
45 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
|
46 ASSERT_EQ(SopClassUid_VideoPhotographicImageStorage, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.77.1.4.1")); |
2094
7c3d65166c26
partial integration dicom-sr->mainline
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2077
diff
changeset
|
47 ASSERT_EQ(SopClassUid_ComprehensiveSR, StringToSopClassUid("1.2.840.10008.5.1.4.1.1.88.33")); |
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
|
48 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
|
49 |
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_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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 } |
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
|
59 |
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
|
60 |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 int main(int argc, char **argv) |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 { |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
63 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
64 std::string output; |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
65 #endif |
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 int result; |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
68 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
69 { |
1680
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
70 OrthancStone::StoneInitialize(); |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
71 Orthanc::Logging::EnableInfoLevel(true); |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
73 ::testing::InitGoogleTest(&argc, argv); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
74 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
75 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
76 ::testing::internal::CaptureStdout(); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
77 #endif |
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 result = RUN_ALL_TESTS(); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
80 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
81 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
82 output = testing::internal::GetCapturedStdout(); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
83 #endif |
1680
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
84 |
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
85 OrthancStone::StoneFinalize(); |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
86 } |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
87 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
88 #if defined(__EMSCRIPTEN__) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
89 EM_ASM({ |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
90 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
|
91 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
|
92 }, |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
93 output.c_str()); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
94 #endif |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 return result; |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 } |