From 6ccf2aabcf0fa0275a9c36edffc173ae092e6186 Mon Sep 17 00:00:00 2001 From: Samuel Herts Date: Tue, 21 May 2024 09:33:47 -0400 Subject: [PATCH] Add max long long calculation --- tests/test.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test.cpp b/tests/test.cpp index 2fb9550..89cecab 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -39,11 +39,15 @@ TEST(BigInt_test, Addition_Tests) bigint small_number = 9955; bigint huge_number_1 = "123456789"; bigint huge_number_2 = "9999999999999999999"; + bigint max_ll = LLONG_MAX; ASSERT_EQ(bigint("10") + bigint("20"), "30"); ASSERT_EQ(small_number + 5, 9960); ASSERT_EQ(small_number + small_number, 19910); ASSERT_EQ(huge_number_1 + 1, "123456790"); ASSERT_EQ(huge_number_2 + 1, "10000000000000000000"); + + ASSERT_EQ( max_ll + 1, "9223372036854775808"); + ASSERT_EQ(huge_number_2 + 1, "10000000000000000000"); } TEST(BigInt_test, Subtraction_Tests) @@ -122,6 +126,14 @@ TEST(BigInt_test, Comparison_Tests) ASSERT_TRUE(bigint(1) == "1"); ASSERT_TRUE(bigint(1) >= "1"); ASSERT_TRUE(bigint(1) <= "1"); + + ASSERT_TRUE(1 < huge_number_1); + ASSERT_FALSE(1 > huge_number_1); + ASSERT_TRUE(10 < huge_number_1); + ASSERT_TRUE("99" < huge_number_1); + ASSERT_TRUE(123456789 <= huge_number_1); + ASSERT_TRUE(123456789 == huge_number_1); + ASSERT_TRUE(123456789 >= huge_number_1); } TEST(BigInt_test, Modulus_Tests)