From c994eddec418b4200b04e7f30287b15159e9eb9d Mon Sep 17 00:00:00 2001 From: Sean Middleditch Date: Tue, 12 Jan 2010 01:34:58 -0800 Subject: [PATCH] expand array assignment tests --- test.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test.cc b/test.cc index 165589f..9b0eb2c 100644 --- a/test.cc +++ b/test.cc @@ -67,5 +67,19 @@ int main() { ASSERT_EQ(e3.size(), 1, "e3 has incorrect number of elements after assignment"); ASSERT_EQ(e3[0].as_string(), "foobar", "e3[0] has incorrect value after assignment"); + e3.set(1, jansson::Value::from("foobar")); + ASSERT_TRUE(e3.is_array(), "e3 is not an array after index assignment"); + ASSERT_EQ(e3.size(), 2, "e3 has incorrect number of elements after assignment"); + ASSERT_EQ(e3[1].as_string(), "foobar", "e3[0] has incorrect value after assignment"); + + e3.set(0, jansson::Value::from("barfoo")); + ASSERT_TRUE(e3.is_array(), "e3 is not an array after index assignment"); + ASSERT_EQ(e3.size(), 2, "e3 has incorrect number of elements after assignment"); + ASSERT_EQ(e3[0].as_string(), "barfoo", "e3[0] has incorrect value after assignment"); + + e3.set(100, jansson::Value::null()); + ASSERT_TRUE(e3.is_array(), "e3 is not an array after index assignment"); + ASSERT_EQ(e3.size(), 2, "e3 has incorrect number of elements after assignment"); + return 0; }