diff options
author | Johannes Schanda <schanda@itestra.de> | 2013-05-27 17:02:17 +0200 |
---|---|---|
committer | Johannes Schanda <schanda@itestra.de> | 2013-05-27 17:02:17 +0200 |
commit | 19e1418b3a7eccb8c0dab68c772633383825c48e (patch) | |
tree | 06be9b74ff08fc8968fe568e71c61f76a140b6a8 | |
parent | e81eb8cbd56a60457664ed72fcf36c531a61e74c (diff) | |
download | genivi-common-api-runtime-19e1418b3a7eccb8c0dab68c772633383825c48e.tar.gz |
Better variant tests
-rwxr-xr-x | src/test/VariantTest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/VariantTest.cpp b/src/test/VariantTest.cpp index 826dbc4..441a288 100755 --- a/src/test/VariantTest.cpp +++ b/src/test/VariantTest.cpp @@ -33,6 +33,9 @@ TEST_F(VariantTest, VariantTestPack) { const int& myInt = myVariant.get<int>(); std::cout << "myInt = " << myInt << "\n"; + int vType = myVariant.getValueType(); + std::cout << "myVariant value type = " << vType << ", should be 0 \n"; + Variant<int, double, std::string> myVariant2 = myVariant; const int& myInt2 = myVariant2.get<int>(); std::cout << "myInt2 = " << myInt2 << "\n"; @@ -50,6 +53,15 @@ TEST_F(VariantTest, VariantTestPack) { std::cout << "myIntCopy equals myInt " << "(" << std::boolalpha << (myVariant == myVariantCopy) << ")\n"; + Variant<int, double, std::string> myVariantCopy2; + myVariantCopy2 = myVariant; + + const int& myIntCopy2 = myVariantCopy2.get<int>(); + std::cout << "myIntCopy2 = " << myIntCopy << "\n"; + + std::cout << "myIntCopy2 equals myInt " << "(" << std::boolalpha << (myVariant == myVariantCopy2) << ")\n"; + + EXPECT_ANY_THROW(const int& myFake = myVariant.get<double>()); std::cout << "myInt is int = " << " (" << std::boolalpha << myVariant.isType<int>() << ")\n"; |