std::math::bigint: Added unit tests for init_with_u128 and init_with_array

This commit is contained in:
Jonas Quinten
2025-02-21 17:52:44 +01:00
committed by Christoffer Lerno
parent 3ba68f85fe
commit b50e6bd0e4

View File

@@ -1,5 +1,20 @@
module std::math::bigint @test;
fn void test_init_with_u128()
{
BigInt bi @noinit;
assert(!bi.init_with_u128(uint128.max).is_negative());
}
fn void init_with_array()
{
BigInt bi @noinit;
assert(bi.init_with_array({0, 0, 0, 1}).equals(bigint::from_int(1)));
assert("100000000" == bi.init_with_array({1, 0}).to_string_with_radix(16, allocator::temp()));
}
fn void test_parse16()
{
BigInt bi @noinit;