diff options
author | inngonch <inngonch@yandex-team.ru> | 2022-02-10 16:49:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:19 +0300 |
commit | 7622df751aca736b9e1e20015e6787d5a65643b0 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/yson/node/node_ut.cpp | |
parent | 259606d47f0a87d4980322c10899f41f246ad20c (diff) | |
download | ydb-7622df751aca736b9e1e20015e6787d5a65643b0.tar.gz |
Restoring authorship annotation for <inngonch@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yson/node/node_ut.cpp')
-rw-r--r-- | library/cpp/yson/node/node_ut.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/yson/node/node_ut.cpp b/library/cpp/yson/node/node_ut.cpp index fcf6adc52b..448e99f575 100644 --- a/library/cpp/yson/node/node_ut.cpp +++ b/library/cpp/yson/node/node_ut.cpp @@ -282,11 +282,11 @@ Y_UNIT_TEST_SUITE(YtNodeTest) { Y_UNIT_TEST(TestIntCast) { TNode node = 1ull << 31; UNIT_ASSERT(node.IsUint64()); - UNIT_ASSERT_EXCEPTION(node.IntCast<i32>(), TNode::TTypeError); - UNIT_ASSERT(node.IntCast<ui32>() == static_cast<ui32>(node.AsUint64())); - UNIT_ASSERT(node.IntCast<i64>() == static_cast<i64>(node.AsUint64())); + UNIT_ASSERT_EXCEPTION(node.IntCast<i32>(), TNode::TTypeError); + UNIT_ASSERT(node.IntCast<ui32>() == static_cast<ui32>(node.AsUint64())); + UNIT_ASSERT(node.IntCast<i64>() == static_cast<i64>(node.AsUint64())); UNIT_ASSERT(node.IntCast<ui64>() == node.AsUint64()); - + node = 1ull << 63; UNIT_ASSERT(node.IsUint64()); UNIT_ASSERT_EXCEPTION(node.IntCast<i64>(), TNode::TTypeError); @@ -294,24 +294,24 @@ Y_UNIT_TEST_SUITE(YtNodeTest) { node = 12345; UNIT_ASSERT(node.IsInt64()); - UNIT_ASSERT_EXCEPTION(node.IntCast<i8>(), TNode::TTypeError); - UNIT_ASSERT_EXCEPTION(node.IntCast<ui8>(), TNode::TTypeError); - UNIT_ASSERT(node.IntCast<i16>() == static_cast<i16>(node.AsInt64())); - UNIT_ASSERT(node.IntCast<ui16>() == static_cast<ui16>(node.AsInt64())); - UNIT_ASSERT(node.IntCast<i32>() == static_cast<i32>(node.AsInt64())); - UNIT_ASSERT(node.IntCast<ui32>() == static_cast<ui32>(node.AsInt64())); + UNIT_ASSERT_EXCEPTION(node.IntCast<i8>(), TNode::TTypeError); + UNIT_ASSERT_EXCEPTION(node.IntCast<ui8>(), TNode::TTypeError); + UNIT_ASSERT(node.IntCast<i16>() == static_cast<i16>(node.AsInt64())); + UNIT_ASSERT(node.IntCast<ui16>() == static_cast<ui16>(node.AsInt64())); + UNIT_ASSERT(node.IntCast<i32>() == static_cast<i32>(node.AsInt64())); + UNIT_ASSERT(node.IntCast<ui32>() == static_cast<ui32>(node.AsInt64())); UNIT_ASSERT(node.IntCast<i64>() == node.AsInt64()); UNIT_ASSERT(node.IntCast<ui64>() == static_cast<ui64>(node.AsInt64())); - + node = -5; UNIT_ASSERT(node.IsInt64()); - UNIT_ASSERT(node.IntCast<i8>() == static_cast<i8>(node.AsInt64())); - UNIT_ASSERT(node.IntCast<i16>() == static_cast<i16>(node.AsInt64())); - UNIT_ASSERT(node.IntCast<i32>() == static_cast<i32>(node.AsInt64())); + UNIT_ASSERT(node.IntCast<i8>() == static_cast<i8>(node.AsInt64())); + UNIT_ASSERT(node.IntCast<i16>() == static_cast<i16>(node.AsInt64())); + UNIT_ASSERT(node.IntCast<i32>() == static_cast<i32>(node.AsInt64())); UNIT_ASSERT(node.IntCast<i64>() == node.AsInt64()); - UNIT_ASSERT_EXCEPTION(node.IntCast<ui8>(), TNode::TTypeError); - UNIT_ASSERT_EXCEPTION(node.IntCast<ui16>(), TNode::TTypeError); - UNIT_ASSERT_EXCEPTION(node.IntCast<ui32>(), TNode::TTypeError); + UNIT_ASSERT_EXCEPTION(node.IntCast<ui8>(), TNode::TTypeError); + UNIT_ASSERT_EXCEPTION(node.IntCast<ui16>(), TNode::TTypeError); + UNIT_ASSERT_EXCEPTION(node.IntCast<ui32>(), TNode::TTypeError); UNIT_ASSERT_EXCEPTION(node.IntCast<ui64>(), TNode::TTypeError); } @@ -335,20 +335,20 @@ Y_UNIT_TEST_SUITE(YtNodeTest) { } Y_UNIT_TEST(TestConvertDoubleInt) { - UNIT_ASSERT_VALUES_EQUAL(TNode(5.3).ConvertTo<i8>(), 5); - UNIT_ASSERT_VALUES_EQUAL(TNode(5.3).ConvertTo<ui8>(), 5); - UNIT_ASSERT_VALUES_EQUAL(TNode(5.3).ConvertTo<i64>(), 5); + UNIT_ASSERT_VALUES_EQUAL(TNode(5.3).ConvertTo<i8>(), 5); + UNIT_ASSERT_VALUES_EQUAL(TNode(5.3).ConvertTo<ui8>(), 5); + UNIT_ASSERT_VALUES_EQUAL(TNode(5.3).ConvertTo<i64>(), 5); UNIT_ASSERT_VALUES_EQUAL(TNode(5.3).ConvertTo<ui64>(), 5); - - UNIT_ASSERT_VALUES_EQUAL(TNode(-5.3).ConvertTo<i8>(), -5); + + UNIT_ASSERT_VALUES_EQUAL(TNode(-5.3).ConvertTo<i8>(), -5); UNIT_ASSERT_VALUES_EQUAL(TNode(-5.3).ConvertTo<i64>(), -5); - UNIT_ASSERT_EXCEPTION(TNode(-5.3).ConvertTo<ui8>(), TNode::TTypeError); + UNIT_ASSERT_EXCEPTION(TNode(-5.3).ConvertTo<ui8>(), TNode::TTypeError); UNIT_ASSERT_EXCEPTION(TNode(-5.3).ConvertTo<ui64>(), TNode::TTypeError); - + UNIT_ASSERT_VALUES_EQUAL(TNode(127.0).ConvertTo<i8>(), 127); UNIT_ASSERT_EXCEPTION(TNode(128.0).ConvertTo<i8>(), TNode::TTypeError); UNIT_ASSERT_VALUES_EQUAL(TNode(255.0).ConvertTo<ui8>(), 255); - UNIT_ASSERT_EXCEPTION(TNode(256.0).ConvertTo<ui8>(), TNode::TTypeError); + UNIT_ASSERT_EXCEPTION(TNode(256.0).ConvertTo<ui8>(), TNode::TTypeError); UNIT_ASSERT_EXCEPTION(TNode(1e100).ConvertTo<i64>(), TNode::TTypeError); UNIT_ASSERT_EXCEPTION(TNode(1e100).ConvertTo<ui64>(), TNode::TTypeError); { |