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

Function test

code/mathematics/linear_recurrence.test.cpp:13–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11}
12
13void test() {
14 // Field testing: Project Euler 258
15
16 ll mod = 1000000007;
17 for (int it = 0; it < 1000; it++) {
18 int k = rng() % 10 + 1;
19 vector<ll> init, c;
20 rep(i,0,k) init.push_back(rng() % mod);
21 rep(i,0,k) c.push_back(rng() % mod);
22 for (int jt = 0; jt < 20; jt++) {
23 ll n = rng() % 10;
24 assert_equal(slow(init, c, n, mod), nth_term(init, c, n, mod), true);
25
26 n = rng() % 100;
27 assert_equal(slow(init, c, n, mod), nth_term(init, c, n, mod), true);
28
29 n = rng() % 1000;
30 assert_equal(slow(init, c, n, mod), nth_term(init, c, n, mod), true);
31
32 n = rng() % 1000;
33 assert_equal(slow(init, c, n, 123456), nth_term(init, c, n, 123456), true);
34 }
35 }
36}

Callers

nothing calls this directly

Calls 4

nth_termFunction · 0.85
push_backMethod · 0.80
slowFunction · 0.70
assert_equalFunction · 0.50

Tested by

no test coverage detected