diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/codec-json.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/codec-json.cpp b/tests/codec-json.cpp index 926f550..e1b8b5c 100644 --- a/tests/codec-json.cpp +++ b/tests/codec-json.cpp @@ -213,7 +213,7 @@ SAW_TEST("String write and read"){ SAW_EXPECT(nat_str == "foo", "Incorrect value decoded"); } -SAW_TEST("Tuple write"){ +SAW_TEST("Tuple read and write"){ using namespace saw; data<schema::TestTuple, encode::Native> native_tup; data<schema::TestTuple, encode::Json> json_tup; @@ -233,6 +233,13 @@ SAW_TEST("Tuple write"){ std::string enc_val = convert_to_string(json_tup.get_buffer()); SAW_EXPECT(enc_val == str_v, std::string{"Tuple not encoded correctly. Encoded: "} + enc_val + std::string{" Expected: "} + std::string{str_v}); + native_tup = {}; + + eov = json_codec.decode(json_tup, native_tup); + SAW_EXPECT(eov.is_value(), "Decoding error"); + + SAW_EXPECT(native_tup.template get<0>() == "bar", "Invalid Value 0"); + SAW_EXPECT(native_tup.template get<1>().get() == 34, "Invalid Value 1"); } SAW_TEST("Array write"){ |