diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-13 11:40:04 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-15 01:00:20 +0000 |
commit | 3ad1f250e74cab9176de2fc2a0958753785bea66 (patch) | |
tree | c635076143dc35e0769fc92170faa36c6b3eec0b /Tests/LibCrypto/TestBigInteger.cpp | |
parent | 0ddc2e1f503e8566c7f153741739d380fc05a09f (diff) | |
download | serenity-3ad1f250e74cab9176de2fc2a0958753785bea66.zip |
LibCrypto: Define *BigInteger::to_base to convert big integers to String
Diffstat (limited to 'Tests/LibCrypto/TestBigInteger.cpp')
-rw-r--r-- | Tests/LibCrypto/TestBigInteger.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Tests/LibCrypto/TestBigInteger.cpp b/Tests/LibCrypto/TestBigInteger.cpp index 338ec233d1..91f82e6f92 100644 --- a/Tests/LibCrypto/TestBigInteger.cpp +++ b/Tests/LibCrypto/TestBigInteger.cpp @@ -241,9 +241,10 @@ TEST_CASE(test_unsigned_bigint_base10_from_string) TEST_CASE(test_unsigned_bigint_base10_to_string) { - auto result = Crypto::UnsignedBigInteger { + auto bigint = Crypto::UnsignedBigInteger { Vector<u32> { 3806301393, 954919431, 3879607298, 721 } - }.to_base_deprecated(10); + }; + auto result = MUST(bigint.to_base(10)); EXPECT_EQ(result, "57195071295721390579057195715793"); } @@ -386,10 +387,10 @@ TEST_CASE(test_bigint_random_distribution) "100000000000000000000000000000"_bigint); // 10**29 if (actual_result < "100000000000000000000"_bigint) { // 10**20 FAIL("Too small"); - outln("The generated number {} is extremely small. This *can* happen by pure chance, but should happen only once in a billion times. So it's probably an error.", actual_result.to_base_deprecated(10)); + outln("The generated number {} is extremely small. This *can* happen by pure chance, but should happen only once in a billion times. So it's probably an error.", MUST(actual_result.to_base(10))); } else if ("99999999900000000000000000000"_bigint < actual_result) { // 10**29 - 10**20 FAIL("Too large"); - outln("The generated number {} is extremely large. This *can* happen by pure chance, but should happen only once in a billion times. So it's probably an error.", actual_result.to_base_deprecated(10)); + outln("The generated number {} is extremely large. This *can* happen by pure chance, but should happen only once in a billion times. So it's probably an error.", MUST(actual_result.to_base(10))); } } |