MCPcopy Create free account
hub / github.com/cp-algorithms/cp-algorithms / main

Function main

test/test_fibonacci.cpp:17–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17int main() {
18 vector<int> expected = {
19 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987,
20 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025,
21 121393, 196418, 317811, 514229, 832040, 1346269,
22 2178309, 3524578, 5702887, 9227465, 14930352, 24157817,
23 39088169, 63245986, 102334155
24 };
25
26 for (int i = 0; i < expected.size(); i++) {
27 assert(FibLinear::fib(i) == expected[i]);
28 }
29
30 for (int i = 0; i < expected.size(); i++) {
31 assert(FibMatrix::fib(i) == expected[i]);
32 }
33
34 for (int i = 0; i < expected.size(); i++) {
35 assert(FibDoubling::fib(i).first == expected[i]);
36 }
37}
38

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected