Permalink
Browse files

Fix unit test

    One of the unordered multi map tests depended on the order the values
    were serialized in. Since this is an unordered map we don't want that
    constraint. So updated the test to make sure any order is supported.
  • Loading branch information...
1 parent fe32afb commit 5ec6a205e84beddeea6a482359b08180ee4678e7 @Loki-Astari committed Sep 5, 2016
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/Serialize/test/SerUnorderedMultiMap.cpp
@@ -17,7 +17,10 @@ TEST(SerUnorderedMultiMapTest, serialize)
std::string result = stream.str();
result.erase(std::remove_if(std::begin(result), std::end(result), [](char x){return ::isspace(x);}), std::end(result));
- EXPECT_EQ(result, R"([{"first":56,"second":78.901},{"first":56,"second":901}])");
+ bool test = result == R"([{"first":56,"second":78.901},{"first":56,"second":901}])"
+ || result == R"([{"first":56,"second":901},{"first":56,"second":78.901}])";
+
+ EXPECT_TRUE(test);
}
TEST(SerUnorderedMultiMapTest, deSerialize)
@@ -44,7 +47,14 @@ TEST(SerUnorderedMultiMapTest, serializeStringKey)
std::string result = stream.str();
result.erase(std::remove_if(std::begin(result), std::end(result), [](char x){return ::isspace(x);}), std::end(result));
- EXPECT_EQ(result, R"({"AStringKey":78.902,"TestValue":22.903,"TestValue":903})");
+ bool test = result == R"({"AStringKey":78.902,"TestValue":22.903,"TestValue":903})"
+ || result == R"({"AStringKey":78.902,"TestValue":903,"TestValue":22.903})"
+ || result == R"({"TestValue":22.903,"AStringKey":78.902,"TestValue":903})"
+ || result == R"({"TestValue":22.903,"TestValue":903,"AStringKey":78.902})"
+ || result == R"({"TestValue":903,"AStringKey":78.902,"TestValue":22.903})"
+ || result == R"({"TestValue":903,"TestValue":22.903,"AStringKey":78.902})";
+
+ EXPECT_TRUE(test);
}
TEST(SerUnorderedMultiMapTest, deSerializeStringKey)

0 comments on commit 5ec6a20

Please sign in to comment.