MCPcopy Create free account
hub / github.com/atcoder/ac-library / TEST

Function TEST

test/unittest/math_test.cpp:45–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45TEST(MathTest, PowMod) {
46 auto naive = [&](ll x, ll n, int mod) {
47 ll y = internal::safe_mod(x, mod);
48 ull z = 1 % mod;
49 for (ll i = 0; i < n; i++) {
50 z = (z * y) % mod;
51 }
52 return z;
53 };
54 for (int a = -100; a <= 100; a++) {
55 for (int b = 0; b <= 100; b++) {
56 for (int c = 1; c <= 100; c++) {
57 ASSERT_EQ(naive(a, b, c), pow_mod(a, b, c));
58 }
59 }
60 }
61}
62
63TEST(MathTest, InvBoundHand) {
64 const ll minll = std::numeric_limits<ll>::min();

Callers

nothing calls this directly

Calls 7

safe_modFunction · 0.85
pow_modFunction · 0.85
inv_modFunction · 0.85
floor_sumFunction · 0.85
crtFunction · 0.85
gcdFunction · 0.70
floor_sum_naiveFunction · 0.70

Tested by

no test coverage detected