summaryrefslogtreecommitdiff
path: root/source/test
diff options
context:
space:
mode:
Diffstat (limited to 'source/test')
-rw-r--r--source/test/unittests/bigint.test.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/test/unittests/bigint.test.c b/source/test/unittests/bigint.test.c
index 0b45d7b..048bcca 100644
--- a/source/test/unittests/bigint.test.c
+++ b/source/test/unittests/bigint.test.c
@@ -56,6 +56,28 @@ TEST("bigint base58 mul") {
}
TEST("bigint div") {
+ REQUIRE(bi_equal(bi_div(bi_int32(-1), bi_int32(-1)).quotient,
+ bi_int32(1)));
+ REQUIRE(bi_equal(bi_div(bi_int32(-1), bi_int32(-1)).remainder,
+ bi_int32(0)));
+ REQUIRE(bi_equal(bi_div(bi_int32(-3), bi_int32(2)).quotient,
+ bi_int32(-2)));
+ REQUIRE(bi_equal(bi_div(bi_int32(-3), bi_int32(2)).remainder,
+ bi_int32(1)));
+ REQUIRE(bi_equal(bi_div(bi_int32(3), bi_int32(-2)).quotient,
+ bi_int32(-1)));
+ REQUIRE(bi_equal(bi_div(bi_int32(3), bi_int32(-2)).remainder,
+ bi_int32(1)));
+ REQUIRE(bi_equal(bi_div(bi_int32(-3), bi_int32(4)).quotient,
+ bi_int32(-1)));
+ REQUIRE(bi_equal(bi_div(bi_int32(-3), bi_int32(4)).remainder,
+ bi_int32(3)));
+ REQUIRE(bi_equal(bi_div(bi_int32(3), bi_int32(-4)).quotient,
+ bi_int32(0)));
+ REQUIRE(bi_equal(bi_div(bi_int32(3), bi_int32(-4)).remainder,
+ bi_int32(3)));
+
+
REQUIRE(
bi_equal(bi_div(HEX("100"), HEX("10")).quotient, HEX("10")));