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

Function TEST

test/unittest/modint_test.cpp:41–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39static_assert(modint1000000007::mod() == 1000000007, "");
40
41TEST(ModintTest, DynamicBorder) {
42 using mint = modint;
43 const int mod_upper = std::numeric_limits<int>::max();
44 for (unsigned int mod = mod_upper; mod >= mod_upper - 20; mod--) {
45 mint::set_mod(mod);
46 std::vector<ll> v;
47 for (int i = 0; i < 10; i++) {
48 v.push_back(i);
49 v.push_back(mod - i);
50 v.push_back(mod / 2 + i);
51 v.push_back(mod / 2 - i);
52 }
53 for (ll a : v) {
54 ASSERT_EQ(((a * a) % mod * a) % mod, (mint(a).pow(3)).val());
55 for (ll b : v) {
56 ASSERT_EQ((a + b) % mod, (mint(a) + mint(b)).val());
57 ASSERT_EQ((a - b + mod) % mod, (mint(a) - mint(b)).val());
58 ASSERT_EQ((a * b) % mod, (mint(a) * mint(b)).val());
59 }
60 }
61 }
62}
63
64TEST(ModintTest, ULL) {
65 modint::set_mod(998244353);

Callers

nothing calls this directly

Calls 4

gcdFunction · 0.70
valMethod · 0.45
powMethod · 0.45
invMethod · 0.45

Tested by

no test coverage detected