Test that doubles in JsonValue are copied

This commit is contained in:
Benoit Blanchon
2014-09-28 21:22:20 +02:00
parent 42ce5ab31f
commit d549070fd3
2 changed files with 16 additions and 2 deletions

View File

@ -59,12 +59,20 @@ TEST_F(JsonValueTests, CanStoreObject)
EXPECT_EQ(innerObject1, (JsonObject) jsonValue1);
}
TEST_F(JsonValueTests, CanCopyInteger)
TEST_F(JsonValueTests, IntegerValuesAreCopied)
{
jsonValue1 = 123;
jsonValue2 = jsonValue1;
jsonValue1 = 456;
EXPECT_EQ(456, (int) jsonValue1);
EXPECT_EQ(123, (int) jsonValue2);
}
TEST_F(JsonValueTests, DoubleValuesAreCopied)
{
jsonValue1 = 123.45;
jsonValue2 = jsonValue1;
jsonValue1 = 456.78;
EXPECT_EQ(123.45, (double) jsonValue2);
}