summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/commonlib/bsd/gcd-test.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/tests/commonlib/bsd/gcd-test.c b/tests/commonlib/bsd/gcd-test.c
index 13fad86ec4..852a3fd93d 100644
--- a/tests/commonlib/bsd/gcd-test.c
+++ b/tests/commonlib/bsd/gcd-test.c
@@ -3,24 +3,29 @@
#include <commonlib/bsd/gcd.h>
#include <tests/test.h>
-static void test_gcd32(void **state)
+static void test_gcd(void **state)
{
- assert_int_equal(gcd32(17, 11), 1);
- assert_int_equal(gcd32(64, 36), 4);
- assert_int_equal(gcd32(90, 123), 3);
- assert_int_equal(gcd32(65536, 339584), 128);
- assert_int_equal(gcd32(1, 1), 1);
- assert_int_equal(gcd32(1, 123), 1);
- assert_int_equal(gcd32(123, 1), 1);
- assert_int_equal(gcd32(1, UINT32_MAX), 1);
- assert_int_equal(gcd32(UINT32_MAX, 1), 1);
- assert_int_equal(gcd32(UINT32_MAX, UINT32_MAX), UINT32_MAX);
+ assert_int_equal(gcd(17, 11), 1);
+ assert_int_equal(gcd(64, 36), 4);
+ assert_int_equal(gcd(90, 123), 3);
+ assert_int_equal(gcd(65536, 339584), 128);
+ assert_int_equal(gcd(1, 1), 1);
+ assert_int_equal(gcd(1, 123), 1);
+ assert_int_equal(gcd(123, 1), 1);
+ assert_int_equal(gcd(1, UINT32_MAX), 1);
+ assert_int_equal(gcd(UINT32_MAX, 1), 1);
+ assert_int_equal(gcd(UINT32_MAX, UINT32_MAX), UINT32_MAX);
+ assert_int_equal(gcd(1, UINT64_MAX), 1);
+ assert_int_equal(gcd(UINT64_MAX, 1), 1);
+ assert_int_equal(gcd(UINT64_MAX, UINT64_MAX), UINT64_MAX);
+ assert_int_equal(gcd((uint64_t)UINT32_MAX + 1, UINT64_MAX / 2 + 1),
+ (uint64_t)UINT32_MAX + 1);
}
int main(void)
{
const struct CMUnitTest tests[] = {
- cmocka_unit_test(test_gcd32),
+ cmocka_unit_test(test_gcd),
};
return cb_run_group_tests(tests, NULL, NULL);