MCPcopy Create free account
hub / github.com/coreboot/coreboot / test_gcd

Function test_gcd

tests/commonlib/bsd/gcd-test.c:6–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <tests/test.h>
5
6static void test_gcd(void **state)
7{
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);
23}
24
25int main(void)
26{

Callers

nothing calls this directly

Calls 1

gcdFunction · 0.85

Tested by

no test coverage detected