Skip to content

Commit

Permalink
Small refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvov1 committed Oct 21, 2024
1 parent 1a185b1 commit cd673ae
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions test/operations/initialization/signed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,35 @@ TEST(Signed_Initialization, Basic) {
}
{
using namespace std::string_literals; using namespace std::string_view_literals;
Aesi512 d0 = "489133282872437279"s, d1 = "63018038201"sv, d2 = "-489133282872437279"s, d3 = "-63018038201"sv;
EXPECT_EQ(d0, 489133282872437279); EXPECT_EQ(d1, 63018038201); EXPECT_EQ(d2, -489133282872437279); EXPECT_EQ(d3, -63018038201);
Aesi512 d0 = "489133282872437279"s; EXPECT_EQ(d0, 489133282872437279);
d0 = "63018038201"sv; EXPECT_EQ(d0, 63018038201);
d0 = "-489133282872437279"s; EXPECT_EQ(d0, -489133282872437279);
d0 = "-63018038201"sv; EXPECT_EQ(d0, -63018038201);

Aesi512 b0 = "0b11011001001110000000010000100010101011011101010101000011111"s; EXPECT_EQ(b0, 489133282872437279);
Aesi512 b1 = "0b111010101100001010101111001110111001"sv; EXPECT_EQ(b1, 63018038201);
Aesi512 b2 = "-0b11011001001110000000010000100010101011011101010101000011111"s; EXPECT_EQ(b2, -489133282872437279);
Aesi512 b3 = "-0b111010101100001010101111001110111001"sv; EXPECT_EQ(b3, -63018038201);

Aesi512 o0 = "0o106274176273174613"s, o1 = "0o642054234601645202742"sv, o2 = "-0o106274176273174613"s, o3 = "-0o642054234601645202742"sv;
EXPECT_EQ(o0, 2475842268363147); EXPECT_EQ(o1, 7531577461358003682); EXPECT_EQ(o2, -2475842268363147); EXPECT_EQ(o3, -7531577461358003682);
Aesi512 o0 = "0o106274176273174613"s; EXPECT_EQ(o0, 2475842268363147);
o0 = "0o642054234601645202742"sv; EXPECT_EQ(o0, 7531577461358003682);
o0 = "-0o106274176273174613"s; EXPECT_EQ(o0, -2475842268363147);
o0 = "-0o642054234601645202742"sv; EXPECT_EQ(o0, -7531577461358003682);

Aesi512 h0 = "0x688589CC0E9505E2"s, h1 = "0x3C9D4B9CB52FE"sv, h2 = "-0x688589CC0E9505E2"s, h3 = "-0x3C9D4B9CB52FE"sv;
EXPECT_EQ(h0, 7531577461358003682); EXPECT_EQ(h1, 1066340417491710); EXPECT_EQ(h2, -7531577461358003682); EXPECT_EQ(h3, -1066340417491710);
Aesi512 h4 = "0x688589cc0e9505e2"s, h5 = "0x3c9d4b9cb52fe"sv, h6 = "-0x688589cc0e9505e2"s, h7 = "-0x3c9d4b9cb52fe"sv;
EXPECT_EQ(h4, 7531577461358003682); EXPECT_EQ(h5, 1066340417491710); EXPECT_EQ(h6, -7531577461358003682); EXPECT_EQ(h7, -1066340417491710);
Aesi512 h0 = "0x688589CC0E9505E2"s; EXPECT_EQ(h0, 7531577461358003682);
h0 = "0x3C9D4B9CB52FE"sv; EXPECT_EQ(h0, 1066340417491710);
h0 = "-0x688589CC0E9505E2"s; EXPECT_EQ(h0, -7531577461358003682);
h0 = "-0x3C9D4B9CB52FE"sv; EXPECT_EQ(h0, -1066340417491710);

d0 = L"489133282872437279"s, d1 = L"63018038201"sv, d2 = L"-489133282872437279"s, d3 = L"-63018038201"sv;
EXPECT_EQ(d0, 489133282872437279); EXPECT_EQ(d1, 63018038201); EXPECT_EQ(d2, -489133282872437279); EXPECT_EQ(d3, -63018038201);
Aesi512 h4 = "0x688589cc0e9505e2"s; EXPECT_EQ(h4, 7531577461358003682);
h4 = "0x3c9d4b9cb52fe"sv; EXPECT_EQ(h4, 1066340417491710);
h4 = "-0x688589cc0e9505e2"s; EXPECT_EQ(h4, -7531577461358003682);
h4 = "-0x3c9d4b9cb52fe"sv; EXPECT_EQ(h4, -1066340417491710);

d0 = L"489133282872437279"s; EXPECT_EQ(d0, 489133282872437279);
d0 = L"63018038201"sv; EXPECT_EQ(d0, 63018038201);
d0 = L"-489133282872437279"s; EXPECT_EQ(d0, -489133282872437279);
d0 = L"-63018038201"sv; EXPECT_EQ(d0, -63018038201);

b0 = L"0b11011001001110000000010000100010101011011101010101000011111"s; EXPECT_EQ(b0, 489133282872437279);
b1 = L"0b111010101100001010101111001110111001"sv; EXPECT_EQ(b1, 63018038201);
Expand All @@ -69,13 +80,20 @@ TEST(Signed_Initialization, Basic) {
b0 = L"-----------------0b11011001001110000000010000100010101011011101010101000011111"s; EXPECT_EQ(b0, -489133282872437279LL);
b0 = L"------------------0b11011001001110000000010000100010101011011101010101000011111"s; EXPECT_EQ(b0, 489133282872437279LL);

o0 = L"0o106274176273174613"s, o1 = L"0o642054234601645202742"sv, o2 = L"-0o106274176273174613"s, o3 = L"-0o642054234601645202742"sv;
EXPECT_EQ(o0, 2475842268363147); EXPECT_EQ(o1, 7531577461358003682); EXPECT_EQ(o2, -2475842268363147); EXPECT_EQ(o3, -7531577461358003682);
o0 = L"0o106274176273174613"s; EXPECT_EQ(o0, 2475842268363147);
o0 = L"0o642054234601645202742"sv; EXPECT_EQ(o0, 7531577461358003682);
o0 = L"-0o106274176273174613"s; EXPECT_EQ(o0, -2475842268363147);
o0 = L"-0o642054234601645202742"sv; EXPECT_EQ(o0, -7531577461358003682);

h0 = L"0x688589CC0E9505E2"s; EXPECT_EQ(h0, 7531577461358003682);
h0 = L"0x3C9D4B9CB52FE"sv; EXPECT_EQ(h0, 1066340417491710);
h0 = L"-0x688589CC0E9505E2"s; EXPECT_EQ(h0, -7531577461358003682);
h0 = L"-0x3C9D4B9CB52FE"sv; EXPECT_EQ(h0, -1066340417491710);

h0 = L"0x688589CC0E9505E2"s, h1 = L"0x3C9D4B9CB52FE"sv, h2 = L"-0x688589CC0E9505E2"s, h3 = L"-0x3C9D4B9CB52FE"sv;
EXPECT_EQ(h0, 7531577461358003682); EXPECT_EQ(h1, 1066340417491710); EXPECT_EQ(h2, -7531577461358003682); EXPECT_EQ(h3, -1066340417491710);
h4 = L"0x688589cc0e9505e2"s, h5 = L"0x3c9d4b9cb52fe"sv, h6 = L"-0x688589cc0e9505e2"s, h7 = L"-0x3c9d4b9cb52fe"sv;
EXPECT_EQ(h4, 7531577461358003682); EXPECT_EQ(h5, 1066340417491710); EXPECT_EQ(h6, -7531577461358003682); EXPECT_EQ(h7, -1066340417491710);
h4 = L"0x688589cc0e9505e2"s; EXPECT_EQ(h4, 7531577461358003682);
h4 = L"0x3c9d4b9cb52fe"sv; EXPECT_EQ(h4, 1066340417491710);
h4 = L"-0x688589cc0e9505e2"s; EXPECT_EQ(h4, -7531577461358003682);
h4 = L"-0x3c9d4b9cb52fe"sv; EXPECT_EQ(h4, -1066340417491710);
}
}

Expand Down

0 comments on commit cd673ae

Please sign in to comment.