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

Function test

code/mathematics/mod_inv.test.cpp:3–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "../code/mathematics/gcd.cpp"
2
3void test() {
4 for (ll a = -20; a < 20; a++) {
5 for (ll b = 2; b < 40; b++) {
6 if (gcd(a, b) == 1) {
7 assert_equal(1LL, smod((a * mod_inv(a, b)), b));
8 } else {
9 assert_equal(-1LL, mod_inv(a, b));
10 }
11 }
12 }
13}
14// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 4

smodFunction · 0.85
mod_invFunction · 0.85
gcdFunction · 0.70
assert_equalFunction · 0.50

Tested by

no test coverage detected