Skip to content

Commit

Permalink
Make integer real encoding/decoding tests more strict (#855)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti authored Oct 9, 2024
1 parent 3046d0b commit 11ac344
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/runtime/decode_any_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,11 @@ TEST(JSONBinPack_Decoder, ANY_PACKED_TYPE_TAG_BYTE_PREFIX__real_3_0) {
InputByteStream stream{0x37, 0x03};
Decoder decoder{stream};
const auto result = decoder.ANY_PACKED_TYPE_TAG_BYTE_PREFIX({});
EXPECT_TRUE(result.is_real());
EXPECT_TRUE(result.is_integer_real());
const sourcemeta::jsontoolkit::JSON expected{3.0};
EXPECT_TRUE(expected.is_real());
EXPECT_TRUE(expected.is_integer_real());
EXPECT_EQ(result, expected);
}

Expand All @@ -276,7 +280,11 @@ TEST(JSONBinPack_Decoder, ANY_PACKED_TYPE_TAG_BYTE_PREFIX__real_103_0) {
InputByteStream stream{0x37, 0x67};
Decoder decoder{stream};
const auto result = decoder.ANY_PACKED_TYPE_TAG_BYTE_PREFIX({});
EXPECT_TRUE(result.is_real());
EXPECT_TRUE(result.is_integer_real());
const sourcemeta::jsontoolkit::JSON expected{103.0};
EXPECT_TRUE(expected.is_real());
EXPECT_TRUE(expected.is_integer_real());
EXPECT_EQ(result, expected);
}

Expand Down

0 comments on commit 11ac344

Please sign in to comment.