From 3729638138e3154e6672ade78d177d0b098b8236 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Sun, 11 Dec 2022 23:54:08 +0100 Subject: [bigint] Fix hex parsing --- source/test/unittests/bigint.test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/test/unittests/bigint.test.c') diff --git a/source/test/unittests/bigint.test.c b/source/test/unittests/bigint.test.c index 5ca49b5..0b45d7b 100644 --- a/source/test/unittests/bigint.test.c +++ b/source/test/unittests/bigint.test.c @@ -6,6 +6,17 @@ static_assert(sizeof(bigint_t) == 256, "KIT_BIGINT_SIZE check"); +TEST("bigint bin hex") { + REQUIRE(bi_equal(HEX("10"), BIN("10000"))); + REQUIRE(bi_equal(HEX("20"), BIN("100000"))); + REQUIRE(bi_equal(HEX("40"), BIN("1000000"))); + REQUIRE(bi_equal(HEX("80"), BIN("10000000"))); + REQUIRE(bi_equal(HEX("310"), BIN("1100010000"))); + REQUIRE(bi_equal(HEX("420"), BIN("10000100000"))); + REQUIRE(bi_equal(HEX("540"), BIN("10101000000"))); + REQUIRE(bi_equal(HEX("780"), BIN("11110000000"))); +} + TEST("bigint hex add") { REQUIRE(bi_equal( bi_add(HEX("4242424242424242424242424242424242424242"), -- cgit v1.2.3