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

Function test

code/mathematics/nck.test.cpp:1–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1void test() {
2 assert_equal(1, nck(0, 0));
3 assert_equal(1, nck(1, 0));
4 assert_equal(1, nck(1, 1));
5 assert_equal(2, nck(2, 1));
6 assert_equal(45, nck(10, 8));
7 assert_equal(462, nck(11, 5));
8 rep(i,2,500) {
9 bool ok = true;
10 rep(j,2,i) if (i%j==0) ok = false;
11 if (!ok) continue;
12 assert_equal(1%i, nck(0, 0, i));
13 assert_equal(1%i, nck(1, 0, i));
14 assert_equal(1%i, nck(1, 1, i));
15 assert_equal(2%i, nck(2, 1, i));
16 assert_equal(45%i, nck(10, 8, i));
17 assert_equal(462%i, nck(11, 5, i));
18 }
19}
20// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 2

nckFunction · 0.85
assert_equalFunction · 0.50

Tested by

no test coverage detected