Fix use of uninitialized variable in ut 95/34695/1
authorPiotr Bartosiewicz <p.bartosiewi@partner.samsung.com>
Fri, 30 Jan 2015 13:08:09 +0000 (14:08 +0100)
committerPiotr Bartosiewicz <p.bartosiewi@partner.samsung.com>
Fri, 30 Jan 2015 13:08:09 +0000 (14:08 +0100)
[Bug/Feature]   N/A
[Cause]         N/A
[Solution]      N/A
[Verification]  Run tests under valgrind

Change-Id: Ibe0f6d7da3a8592abd660b66f252ae0bf2fbf896

tests/unit_tests/config/testconfig-example.hpp
tests/unit_tests/config/ut-configuration.cpp

index c8563d0..c05b63c 100644 (file)
@@ -160,4 +160,18 @@ const std::string jsonTestString =
         "{ \"type\": \"SubConfig\", \"value\": { \"intVal\": 54321, \"intVector\": [ 1 ], "
             "\"subSubObj\": { \"intVal\": 234 } } } ] }";
 
+const std::string jsonEmptyTestString =
+    "{ \"intVal\": 0, "
+    "\"int64Val\": 0, "
+    "\"stringVal\": \"\", "
+    "\"boolVal\": false, "
+    "\"emptyIntVector\": [ ], "
+    "\"intVector\": [ ], "
+    "\"stringVector\": [ ], "
+    "\"subObj\": { \"intVal\": 0, \"intVector\": [ ], \"subSubObj\": { \"intVal\": 0 } }, "
+    "\"subVector\": [ ], "
+    "\"union1\": { \"type\": \"int\", \"value\": 0 }, "
+    "\"union2\": { \"type\": \"int\", \"value\": 0 }, "
+    "\"unions\": [ ] }";
+
 #endif
index e014f68..2e3b487 100644 (file)
@@ -304,10 +304,7 @@ BOOST_AUTO_TEST_CASE(FromKVWithDefaultsTest)
     // all in db
     saveToKVStore(DB_PATH, config, DB_PREFIX);
     TestConfig outConfig2;
-    outConfig2.union1.set<int>(0);
-    outConfig2.union2.set<int>(0);
-    std::string emptyConfig = saveToJsonString(outConfig2);
-    loadFromKVStoreWithJson(DB_PATH, emptyConfig, outConfig2, DB_PREFIX);
+    loadFromKVStoreWithJson(DB_PATH, jsonEmptyTestString, outConfig2, DB_PREFIX);
 
     std::string out2 = saveToJsonString(outConfig2);
     BOOST_CHECK_EQUAL(out2, jsonTestString);