mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
std::math::bigint: Added unit tests for init_with_u128 and init_with_array
This commit is contained in:
committed by
Christoffer Lerno
parent
3ba68f85fe
commit
b50e6bd0e4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user