comparison UnitTestsSources/UnitTestsMain.cpp @ 2411:82d5e305fbd9

fix gcc warnings in unit tests
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 Sep 2017 10:16:28 +0200
parents ae50eccd41b7
children 330349d712f9
comparison
equal deleted inserted replaced
2410:3590c936e56f 2411:82d5e305fbd9
975 ASSERT_EQ("nope", Toolbox::GetJsonStringField(v, "hello", "nope")); 975 ASSERT_EQ("nope", Toolbox::GetJsonStringField(v, "hello", "nope"));
976 976
977 v = Json::objectValue; 977 v = Json::objectValue;
978 ASSERT_EQ("nope", Toolbox::GetJsonStringField(v, "hello", "nope")); 978 ASSERT_EQ("nope", Toolbox::GetJsonStringField(v, "hello", "nope"));
979 ASSERT_EQ(-10, Toolbox::GetJsonIntegerField(v, "hello", -10)); 979 ASSERT_EQ(-10, Toolbox::GetJsonIntegerField(v, "hello", -10));
980 ASSERT_EQ(10, Toolbox::GetJsonUnsignedIntegerField(v, "hello", 10)); 980 ASSERT_EQ(10u, Toolbox::GetJsonUnsignedIntegerField(v, "hello", 10));
981 ASSERT_TRUE(Toolbox::GetJsonBooleanField(v, "hello", true)); 981 ASSERT_TRUE(Toolbox::GetJsonBooleanField(v, "hello", true));
982 982
983 v["hello"] = "world"; 983 v["hello"] = "world";
984 ASSERT_EQ("world", Toolbox::GetJsonStringField(v, "hello", "nope")); 984 ASSERT_EQ("world", Toolbox::GetJsonStringField(v, "hello", "nope"));
985 ASSERT_THROW(Toolbox::GetJsonIntegerField(v, "hello", -10), OrthancException); 985 ASSERT_THROW(Toolbox::GetJsonIntegerField(v, "hello", -10), OrthancException);
993 ASSERT_THROW(Toolbox::GetJsonBooleanField(v, "hello", true), OrthancException); 993 ASSERT_THROW(Toolbox::GetJsonBooleanField(v, "hello", true), OrthancException);
994 994
995 v["hello"] = 42; 995 v["hello"] = 42;
996 ASSERT_THROW(Toolbox::GetJsonStringField(v, "hello", "nope"), OrthancException); 996 ASSERT_THROW(Toolbox::GetJsonStringField(v, "hello", "nope"), OrthancException);
997 ASSERT_EQ(42, Toolbox::GetJsonIntegerField(v, "hello", -10)); 997 ASSERT_EQ(42, Toolbox::GetJsonIntegerField(v, "hello", -10));
998 ASSERT_EQ(42, Toolbox::GetJsonUnsignedIntegerField(v, "hello", 10)); 998 ASSERT_EQ(42u, Toolbox::GetJsonUnsignedIntegerField(v, "hello", 10));
999 ASSERT_THROW(Toolbox::GetJsonBooleanField(v, "hello", true), OrthancException); 999 ASSERT_THROW(Toolbox::GetJsonBooleanField(v, "hello", true), OrthancException);
1000 1000
1001 v["hello"] = false; 1001 v["hello"] = false;
1002 ASSERT_THROW(Toolbox::GetJsonStringField(v, "hello", "nope"), OrthancException); 1002 ASSERT_THROW(Toolbox::GetJsonStringField(v, "hello", "nope"), OrthancException);
1003 ASSERT_THROW(Toolbox::GetJsonIntegerField(v, "hello", -10), OrthancException); 1003 ASSERT_THROW(Toolbox::GetJsonIntegerField(v, "hello", -10), OrthancException);