annotate UnitTestsSources/DatabaseLookupTests.cpp @ 2944:f395460af74d

simplifying OrthancConfiguration for modalities/peers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Nov 2018 16:31:20 +0100
parents 1723cbba55c7
children 039a9d262d64 4e43e67f8ecf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2893
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "PrecompiledHeadersUnitTests.h"
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "gtest/gtest.h"
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "../OrthancServer/Search/DatabaseLookup.h"
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #include "../Core/OrthancException.h"
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 using namespace Orthanc;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 TEST(DatabaseLookup, SingleConstraint)
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 ASSERT_THROW(DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_Equal,
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 "HEL*LO", true), OrthancException);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 ASSERT_THROW(DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_Equal,
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 "HEL?LO", true), OrthancException);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 ASSERT_THROW(DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_Equal,
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 true), OrthancException);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_Equal, "HELLO", true);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 ASSERT_TRUE(tag.IsMatch("HELLO"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 ASSERT_FALSE(tag.IsMatch("hello"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 ASSERT_TRUE(tag.IsCaseSensitive());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 ASSERT_EQ(ConstraintType_Equal, tag.GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 ASSERT_FALSE(tag.HasTagInfo());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 ASSERT_THROW(tag.GetTagType(), OrthancException);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 ASSERT_THROW(tag.GetLevel(), OrthancException);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 tag.SetTagInfo(DicomTagType_Identifier, ResourceType_Series);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 ASSERT_TRUE(tag.HasTagInfo());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 ASSERT_EQ(DicomTagType_Identifier, tag.GetTagType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 ASSERT_EQ(ResourceType_Series, tag.GetLevel());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 DicomMap m;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 ASSERT_FALSE(tag.IsMatch(m));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 m.SetNullValue(DICOM_TAG_PATIENT_NAME);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 ASSERT_FALSE(tag.IsMatch(m));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 m.SetValue(DICOM_TAG_PATIENT_NAME, "HELLO", true /* binary */);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 ASSERT_FALSE(tag.IsMatch(m));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 m.SetValue(DICOM_TAG_PATIENT_NAME, "HELLO", false /* string */);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 ASSERT_TRUE(tag.IsMatch(m));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_Equal, "HELlo", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 ASSERT_TRUE(tag.IsMatch("HELLO"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 ASSERT_TRUE(tag.IsMatch("hello"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 ASSERT_EQ("HELlo", tag.GetValue());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_Wildcard, "HE*L?O", true);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 ASSERT_TRUE(tag.IsMatch("HELLO"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 ASSERT_TRUE(tag.IsMatch("HELLLLLO"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 ASSERT_TRUE(tag.IsMatch("HELxO"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 ASSERT_FALSE(tag.IsMatch("hello"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_Wildcard, "HE*l?o", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 ASSERT_TRUE(tag.IsMatch("HELLO"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 ASSERT_TRUE(tag.IsMatch("HELLLLLO"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 ASSERT_TRUE(tag.IsMatch("HELxO"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 ASSERT_TRUE(tag.IsMatch("hello"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 ASSERT_FALSE(tag.IsCaseSensitive());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 ASSERT_EQ(ConstraintType_Wildcard, tag.GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_SmallerOrEqual, "123", true);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 ASSERT_TRUE(tag.IsMatch("120"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 ASSERT_TRUE(tag.IsMatch("123"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 ASSERT_FALSE(tag.IsMatch("124"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_GreaterOrEqual, "123", true);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 ASSERT_FALSE(tag.IsMatch("122"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 ASSERT_TRUE(tag.IsMatch("123"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 ASSERT_TRUE(tag.IsMatch("124"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_List, true);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 ASSERT_FALSE(tag.IsMatch("CT"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 ASSERT_FALSE(tag.IsMatch("MR"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 tag.AddValue("CT");
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 ASSERT_TRUE(tag.IsMatch("CT"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 ASSERT_FALSE(tag.IsMatch("MR"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 tag.AddValue("MR");
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 ASSERT_TRUE(tag.IsMatch("CT"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 ASSERT_TRUE(tag.IsMatch("MR"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 ASSERT_FALSE(tag.IsMatch("ct"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 ASSERT_FALSE(tag.IsMatch("mr"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 ASSERT_THROW(tag.GetValue(), OrthancException);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 ASSERT_EQ(2u, tag.GetValues().size());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 DicomTagConstraint tag(DICOM_TAG_PATIENT_NAME, ConstraintType_List, false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 tag.AddValue("ct");
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 tag.AddValue("mr");
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 ASSERT_TRUE(tag.IsMatch("CT"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 ASSERT_TRUE(tag.IsMatch("MR"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 ASSERT_TRUE(tag.IsMatch("ct"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 ASSERT_TRUE(tag.IsMatch("mr"));
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 TEST(DatabaseLookup, FromDicom)
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 lookup.AddDicomConstraint(DICOM_TAG_PATIENT_ID, "HELLO", true);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 ASSERT_EQ(ConstraintType_Equal, lookup.GetConstraint(0).GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 ASSERT_EQ("HELLO", lookup.GetConstraint(0).GetValue());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 ASSERT_TRUE(lookup.GetConstraint(0).IsCaseSensitive());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 ASSERT_TRUE(lookup.GetConstraint(0).HasTagInfo());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 ASSERT_EQ(DicomTagType_Identifier, lookup.GetConstraint(0).GetTagType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 ASSERT_EQ(ResourceType_Patient, lookup.GetConstraint(0).GetLevel());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 lookup.AddDicomConstraint(DICOM_TAG_PATIENT_ID, "HELLO", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 // This is *not* a PN VR => "false" above is *not* used
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 ASSERT_TRUE(lookup.GetConstraint(0).IsCaseSensitive());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 lookup.AddDicomConstraint(DICOM_TAG_PATIENT_NAME, "HELLO", true);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 ASSERT_TRUE(lookup.GetConstraint(0).IsCaseSensitive());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 lookup.AddDicomConstraint(DICOM_TAG_PATIENT_NAME, "HELLO", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 // This is a PN VR => "false" above is used
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 ASSERT_FALSE(lookup.GetConstraint(0).IsCaseSensitive());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 lookup.AddDicomConstraint(DICOM_TAG_SERIES_DESCRIPTION, "2012-2016", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 ASSERT_TRUE(lookup.GetConstraint(0).HasTagInfo());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 ASSERT_EQ(DicomTagType_Main, lookup.GetConstraint(0).GetTagType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 ASSERT_EQ(ResourceType_Series, lookup.GetConstraint(0).GetLevel());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 // This is not a data VR
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 ASSERT_EQ(ConstraintType_Equal, lookup.GetConstraint(0).GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 lookup.AddDicomConstraint(DICOM_TAG_PATIENT_BIRTH_DATE, "2012-2016", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 // This is a data VR => range is effective
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 ASSERT_EQ(2u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 ASSERT_TRUE(lookup.GetConstraint(0).GetConstraintType() != lookup.GetConstraint(1).GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 for (size_t i = 0; i < 2; i++)
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 ASSERT_TRUE(lookup.GetConstraint(i).GetConstraintType() == ConstraintType_SmallerOrEqual ||
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 lookup.GetConstraint(i).GetConstraintType() == ConstraintType_GreaterOrEqual);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 lookup.AddDicomConstraint(DICOM_TAG_PATIENT_BIRTH_DATE, "2012-", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 ASSERT_EQ(ConstraintType_GreaterOrEqual, lookup.GetConstraint(0).GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 ASSERT_EQ("2012", lookup.GetConstraint(0).GetValue());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 lookup.AddDicomConstraint(DICOM_TAG_PATIENT_BIRTH_DATE, "-2016", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 ASSERT_EQ(DICOM_TAG_PATIENT_BIRTH_DATE, lookup.GetConstraint(0).GetTag());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 ASSERT_EQ(ConstraintType_SmallerOrEqual, lookup.GetConstraint(0).GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 ASSERT_EQ("2016", lookup.GetConstraint(0).GetValue());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 lookup.AddDicomConstraint(DICOM_TAG_MODALITIES_IN_STUDY, "CT\\MR", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 ASSERT_EQ(DICOM_TAG_MODALITY, lookup.GetConstraint(0).GetTag());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 ASSERT_EQ(ResourceType_Series, lookup.GetConstraint(0).GetLevel());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 ASSERT_EQ(ConstraintType_List, lookup.GetConstraint(0).GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 const std::set<std::string>& values = lookup.GetConstraint(0).GetValues();
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 ASSERT_EQ(2u, values.size());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 ASSERT_TRUE(values.find("CT") != values.end());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 ASSERT_TRUE(values.find("MR") != values.end());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 ASSERT_TRUE(values.find("nope") == values.end());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 lookup.AddDicomConstraint(DICOM_TAG_STUDY_DESCRIPTION, "CT\\MR", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 ASSERT_EQ(DICOM_TAG_STUDY_DESCRIPTION, lookup.GetConstraint(0).GetTag());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 ASSERT_EQ(ResourceType_Study, lookup.GetConstraint(0).GetLevel());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 ASSERT_EQ(ConstraintType_List, lookup.GetConstraint(0).GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 const std::set<std::string>& values = lookup.GetConstraint(0).GetValues();
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 ASSERT_EQ(2u, values.size());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 ASSERT_TRUE(values.find("CT") != values.end());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 ASSERT_TRUE(values.find("MR") != values.end());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 ASSERT_TRUE(values.find("nope") == values.end());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 lookup.AddDicomConstraint(DICOM_TAG_STUDY_DESCRIPTION, "HE*O", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 ASSERT_EQ(ConstraintType_Wildcard, lookup.GetConstraint(0).GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 lookup.AddDicomConstraint(DICOM_TAG_STUDY_DESCRIPTION, "HE?O", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 ASSERT_EQ(1u, lookup.GetConstraintsCount());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 ASSERT_EQ(ConstraintType_Wildcard, lookup.GetConstraint(0).GetConstraintType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 {
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 DatabaseLookup lookup;
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 lookup.AddDicomConstraint(DICOM_TAG_RELATED_FRAME_OF_REFERENCE_UID, "TEST", false);
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 ASSERT_TRUE(lookup.GetConstraint(0).HasTagInfo());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 ASSERT_EQ(DicomTagType_Generic, lookup.GetConstraint(0).GetTagType());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 ASSERT_EQ(ResourceType_Instance, lookup.GetConstraint(0).GetLevel());
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 }
1723cbba55c7 testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 }