drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / tests / commonlib / bsd / gcd-test.c
blob852a3fd93d8f67b6e7c3f8ba7868829a843cd9d0
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <commonlib/bsd/gcd.h>
4 #include <tests/test.h>
6 static void test_gcd(void **state)
8 assert_int_equal(gcd(17, 11), 1);
9 assert_int_equal(gcd(64, 36), 4);
10 assert_int_equal(gcd(90, 123), 3);
11 assert_int_equal(gcd(65536, 339584), 128);
12 assert_int_equal(gcd(1, 1), 1);
13 assert_int_equal(gcd(1, 123), 1);
14 assert_int_equal(gcd(123, 1), 1);
15 assert_int_equal(gcd(1, UINT32_MAX), 1);
16 assert_int_equal(gcd(UINT32_MAX, 1), 1);
17 assert_int_equal(gcd(UINT32_MAX, UINT32_MAX), UINT32_MAX);
18 assert_int_equal(gcd(1, UINT64_MAX), 1);
19 assert_int_equal(gcd(UINT64_MAX, 1), 1);
20 assert_int_equal(gcd(UINT64_MAX, UINT64_MAX), UINT64_MAX);
21 assert_int_equal(gcd((uint64_t)UINT32_MAX + 1, UINT64_MAX / 2 + 1),
22 (uint64_t)UINT32_MAX + 1);
25 int main(void)
27 const struct CMUnitTest tests[] = {
28 cmocka_unit_test(test_gcd),
31 return cb_run_group_tests(tests, NULL, NULL);