-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (30 loc) · 788 Bytes
/
main.cpp
File metadata and controls
35 lines (30 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "lib/test.hpp"
#include <functional>
class Logic {
public:
int fib(const int n) {
if (n == 0 || n == 1) {
return n;
}
return fib(n - 1) + fib(n - 2);
};
};
class FibbonacciTestHarness : public AbstractTestHarness {
private:
Logic l = Logic();
public:
FibbonacciTestHarness() {
register_test_func("Fibbonacci 5",
[this]() -> void { assert_equal(5, l.fib(5)); });
register_test_func("Fibbonacci 10",
[this]() -> void { assert_equal(10, l.fib(10)); });
}
};
class GlobalTestManager : public TestManager {
public:
GlobalTestManager() { add_test("Fibbonacci Tests", FibbonacciTestHarness()); }
};
int main(int argc, char **argv) {
GlobalTestManager tr = GlobalTestManager();
tr.execute();
}