summaryrefslogtreecommitdiff
path: root/source/test
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2022-12-11 23:54:08 +0100
committerMitya Selivanov <automainint@guattari.tech>2022-12-11 23:54:08 +0100
commit3729638138e3154e6672ade78d177d0b098b8236 (patch)
treeb2332e70c0d52ffddd4d90a14ec2a652ef4961b8 /source/test
parent0223e2faaebcb4065d9c37f55e8798196f911ae9 (diff)
downloadkit-3729638138e3154e6672ade78d177d0b098b8236.zip
[bigint] Fix hex parsing
Diffstat (limited to 'source/test')
-rw-r--r--source/test/unittests/bigint.test.c11
1 files changed, 11 insertions, 0 deletions
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"),