| 31 | #include "../test/pollard_rho_brent.h" |
| 32 | |
| 33 | int main() { |
| 34 | map<long long, vector<long long>> test_data = { |
| 35 | {132, {2, 2, 3, 11}}, |
| 36 | {123456789, {3, 3, 3607, 3803}}, |
| 37 | {4817191, {1303, 3697}} |
| 38 | }; |
| 39 | primes = {2, 3, 5, 7, 1303, 3607}; |
| 40 | |
| 41 | for (auto n_expected : test_data) { |
| 42 | auto n = n_expected.first; |
| 43 | auto expected = n_expected.second; |
| 44 | |
| 45 | assert(trial_division1(n) == expected); |
| 46 | assert(trial_division2(n) == expected); |
| 47 | assert(trial_division3(n) == expected); |
| 48 | assert(trial_division4(n) == expected); |
| 49 | |
| 50 | long long g = pollards_p_minus_1(n); |
| 51 | assert(g > 1 && g < n && n % g == 0); |
| 52 | |
| 53 | g = rho(n); |
| 54 | assert(g > 1 && g < n && n % g == 0); |
| 55 | g = brent(n); |
| 56 | assert(g > 1 && g < n && n % g == 0); |
| 57 | } |
| 58 | } |
nothing calls this directly
no outgoing calls
no test coverage detected