summaryrefslogtreecommitdiff
path: root/test/core
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-16 11:57:16 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-16 11:57:16 +0100
commit9556bd8ac1374daf01700e18e4a025c02b5d3857 (patch)
tree06ae86031eb13892e1606d5ffdad4e267abe77bd /test/core
parent3cca090a650d2e8268977b57aa0dfdb0fb2cae85 (diff)
parent33a70e7dc2624a674094169dbd234959d5433d81 (diff)
Merge branch 'master' of somweyr.de:ousia
Diffstat (limited to 'test/core')
-rw-r--r--test/core/common/ArgumentTest.cpp24
-rw-r--r--test/core/common/VariantReaderTest.cpp12
2 files changed, 33 insertions, 3 deletions
diff --git a/test/core/common/ArgumentTest.cpp b/test/core/common/ArgumentTest.cpp
index 0a2dcfa..ca93f45 100644
--- a/test/core/common/ArgumentTest.cpp
+++ b/test/core/common/ArgumentTest.cpp
@@ -792,8 +792,8 @@ TEST(Arguments, invalid)
Variant::arrayType arr{1};
- ASSERT_TRUE(argsInvalid.validateArray(arr, logger)); // No error message
- ASSERT_FALSE(argsValid.validateArray(arr, logger)); // Too many arguments
+ ASSERT_TRUE(argsInvalid.validateArray(arr, logger)); // No error message
+ ASSERT_FALSE(argsValid.validateArray(arr, logger)); // Too many arguments
}
TEST(Arguments, validateArray)
@@ -879,6 +879,25 @@ TEST(Arguments, validateMap)
{{"a", 2}, {"b", "test"}, {"c", true}, {"d", nullptr}}),
map);
}
+
+ {
+ Variant::mapType map{{"#0", 2}, {"#1", "bla"}, {"#2", false}};
+ ASSERT_FALSE(args.validateMap(map, logger, false, false));
+ ASSERT_EQ(Variant::mapType({{"#0", 2},
+ {"#1", "bla"},
+ {"#2", false},
+ {"a", 0},
+ {"b", "test"},
+ {"c", true}}),
+ map);
+ }
+
+ {
+ Variant::mapType map{{"#0", 2}, {"#1", "bla"}, {"#2", false}};
+ ASSERT_TRUE(args.validateMap(map, logger, false, true));
+ ASSERT_EQ(Variant::mapType({{"a", 2}, {"b", "bla"}, {"c", false}}),
+ map);
+ }
}
TEST(Arguments, validateMissing)
@@ -897,6 +916,5 @@ TEST(Arguments, validateMissing)
ASSERT_EQ(Variant::arrayType({""}), arr);
}
}
-
}
diff --git a/test/core/common/VariantReaderTest.cpp b/test/core/common/VariantReaderTest.cpp
index a23af09..79e567b 100644
--- a/test/core/common/VariantReaderTest.cpp
+++ b/test/core/common/VariantReaderTest.cpp
@@ -1153,6 +1153,18 @@ TEST(VariantReader, parseGenericString)
ASSERT_EQ(0U, loc.getStart());
ASSERT_EQ(15U, loc.getEnd());
}
+
+ // Parse empty string
+ {
+ auto res = VariantReader::parseGenericString("", logger);
+ ASSERT_TRUE(res.first);
+ ASSERT_TRUE(res.second.isString());
+ ASSERT_EQ("", res.second.asString());
+
+ SourceLocation loc = res.second.getLocation();
+ ASSERT_EQ(0U, loc.getStart());
+ ASSERT_EQ(0U, loc.getEnd());
+ }
}
TEST(VariantReader, parseGenericComplex)