comparison UnitTestsSources/UnitTestsMain.cpp @ 2513:97a74f0eac7a

loading DICOM dictionaries in sandboxed environments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 Mar 2018 18:02:07 +0200
parents 4dcafa8d6633
children 9f325c631973
comparison
equal deleted inserted replaced
2512:4dcafa8d6633 2513:97a74f0eac7a
1041 ASSERT_THROW(Toolbox::GetJsonUnsignedIntegerField(v, "hello", 10), OrthancException); 1041 ASSERT_THROW(Toolbox::GetJsonUnsignedIntegerField(v, "hello", 10), OrthancException);
1042 ASSERT_FALSE(Toolbox::GetJsonBooleanField(v, "hello", true)); 1042 ASSERT_FALSE(Toolbox::GetJsonBooleanField(v, "hello", true));
1043 } 1043 }
1044 1044
1045 1045
1046 TEST(Toolbox, LinesIterator)
1047 {
1048 std::string s;
1049
1050 {
1051 std::string content;
1052 Toolbox::LinesIterator it(content);
1053 ASSERT_FALSE(it.GetLine(s));
1054 }
1055
1056 {
1057 std::string content = "\n\r";
1058 Toolbox::LinesIterator it(content);
1059 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1060 ASSERT_FALSE(it.GetLine(s));
1061 }
1062
1063 {
1064 std::string content = "\n Hello \n\nWorld\n\n";
1065 Toolbox::LinesIterator it(content);
1066 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1067 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ(" Hello ", s);
1068 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1069 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("World", s);
1070 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1071 ASSERT_FALSE(it.GetLine(s)); it.Next();
1072 ASSERT_FALSE(it.GetLine(s));
1073 }
1074
1075 {
1076 std::string content = "\r Hello \r\rWorld\r\r";
1077 Toolbox::LinesIterator it(content);
1078 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1079 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ(" Hello ", s);
1080 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1081 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("World", s);
1082 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1083 ASSERT_FALSE(it.GetLine(s)); it.Next();
1084 ASSERT_FALSE(it.GetLine(s));
1085 }
1086
1087 {
1088 std::string content = "\n\r Hello \n\r\n\rWorld\n\r\n\r";
1089 Toolbox::LinesIterator it(content);
1090 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1091 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ(" Hello ", s);
1092 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1093 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("World", s);
1094 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1095 ASSERT_FALSE(it.GetLine(s)); it.Next();
1096 ASSERT_FALSE(it.GetLine(s));
1097 }
1098
1099 {
1100 std::string content = "\r\n Hello \r\n\r\nWorld\r\n\r\n";
1101 Toolbox::LinesIterator it(content);
1102 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1103 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ(" Hello ", s);
1104 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1105 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("World", s);
1106 ASSERT_TRUE(it.GetLine(s)); it.Next(); ASSERT_EQ("", s);
1107 ASSERT_FALSE(it.GetLine(s)); it.Next();
1108 ASSERT_FALSE(it.GetLine(s));
1109 }
1110 }
1111
1112
1046 int main(int argc, char **argv) 1113 int main(int argc, char **argv)
1047 { 1114 {
1048 Logging::Initialize(); 1115 Logging::Initialize();
1049 Logging::EnableInfoLevel(true); 1116 Logging::EnableInfoLevel(true);
1050 Toolbox::DetectEndianness(); 1117 Toolbox::DetectEndianness();