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

Function test

code/mathematics/fastmul.test.cpp:11–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9}
10
11void test() {
12 /* Field testing: SPOJ {MUL,TMUL,VFMUL} */
13
14 int ts = 1000,
15 l1 = 1,
16 l2 = 1000;
17
18 for (int t = 0; t < ts; t++) {
19 // printf("%d\n", t);
20
21 int la = uniform_int_distribution(l1, l2)(rng),
22 lb = uniform_int_distribution(l1, l2)(rng);
23
24 intx a = randint(la),
25 b = randint(lb),
26 c1 = a * b,
27 c2 = fastmul(a, b);
28
29 bool same = !(c1 < c2 || c2 < c1);
30 assert_true(same);
31 }
32}
33
34// vim: cc=60 ts=2 sts=2 sw=2:

Callers

nothing calls this directly

Calls 3

assert_trueFunction · 0.85
randintFunction · 0.70
fastmulFunction · 0.70

Tested by

no test coverage detected