From 83ffd844d1a23a7dec695726468fd081629fe81a Mon Sep 17 00:00:00 2001 From: Evan McCorkle Date: Tue, 24 Oct 2017 23:32:30 -0400 Subject: [PATCH] Added test coverage for AnyValue move/copy assignment. --- test/general/test_containers.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/general/test_containers.cpp b/test/general/test_containers.cpp index 31d33d738..f285dfcfb 100644 --- a/test/general/test_containers.cpp +++ b/test/general/test_containers.cpp @@ -3,6 +3,27 @@ using namespace Cantera; +TEST(AnyValue, is_copyable) { + AnyMap map1, map2; + map1["key"] = "1"; + map2["key"] = "2"; + AnyValue value1 = map1["key"]; + AnyValue value2 = map2["key"]; + value2 = value1; + EXPECT_EQ(value1.asString(), "1"); + EXPECT_EQ(value2.asString(), "1"); +} + +TEST(AnyValue, is_moveable) { + AnyMap map1, map2; + map1["key"] = "1"; + map2["key"] = "2"; + AnyValue value1 = map1["key"]; + AnyValue value2 = map2["key"]; + value2 = std::move(value1); + EXPECT_EQ(value2.asString(), "1"); +} + TEST(AnyMap, paths) { AnyMap m; m["simple"] = "qux";