MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / test

Function test

code/mathematics/gcd.test.cpp:1–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1void test() {
2 assert_equal(3LL * 5, (ll)gcd(2 * 3 * 5 * 5 * 11, 3 * 5 * 13));
3 assert_equal(3LL * 5, (ll)gcd(2 * 3 * 5 * 5 * 11, 3 * 5 * 13 * 17));
4 assert_equal(3LL * 5, (ll)gcd(2 * 3 * 5 * 11, 3 * 5 * 13 * 17));
5 assert_equal(3LL * 5, (ll)gcd(3 * 5 * 11, 3 * 5 * 13 * 17));
6 assert_equal(3LL * 5, (ll)gcd(3 * 5 * 11, 3 * 3 * 5 * 13 * 17));
7 assert_equal(3LL * 3 * 5, (ll)gcd(3 * 3 * 5 * 11, 3 * 3 * 5 * 13 * 17));
8 // assert_equal(3 * 3 * 5, gcd(-1 * 3 * 3 * 5 * 11, 3 * 3 * 5 * 13 * 17));
9 // assert_equal(3 * 3 * 5, gcd(3 * 3 * 5 * 11, -1 * 3 * 3 * 5 * 13 * 17));
10 // assert_equal(-1 * 3 * 3 * 5, gcd(-1 * 3 * 3 * 5 * 11, -1 * 3 * 3 * 5 * 13 * 17));
11
12 for (ll a = 0; a < 20; a++)
13 for (ll b = 0; b < 20; b++)
14 assert_equal(gcd(a, b), gcd(b, a));
15
16 for (ll a = 0; a < 100; a++) {
17 assert_equal(a, (ll)gcd(a, a));
18 assert_equal(1LL, (ll)gcd(1, a));
19 assert_equal(1LL, (ll)gcd(a, 1));
20 }
21}
22// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 2

gcdFunction · 0.70
assert_equalFunction · 0.50

Tested by

no test coverage detected