File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 3
3
#include " polyfill_v1/type_traits.hpp"
4
4
#include < utility>
5
5
6
+ int main ();
7
+
6
8
namespace testing_v1 {
7
9
8
10
template <class Action > struct test_t ;
9
11
10
- void run_all ();
11
-
12
12
class Private {
13
- friend void run_all ();
13
+ friend int ::main ();
14
14
template <class > friend struct test_t ;
15
15
16
16
class Static ;
Original file line number Diff line number Diff line change 2
2
3
3
#include " testing_v1/private.hpp"
4
4
5
- namespace testing_v1 {
6
-
7
5
// test.hpp ====================================================================
8
6
7
+ // / A minimalist test framework.
8
+ namespace testing_v1 {
9
+
9
10
// / Holds a registered test action and should only be used at namespace scope.
10
11
template <class Action > struct test_t : Private::test_t <Action> {
11
12
// / Constructs a test from the given action.
@@ -27,3 +28,6 @@ test_t<std::remove_cvref_t<Action>> test(Action &&action);
27
28
void verify (bool result);
28
29
29
30
} // namespace testing_v1
31
+
32
+ // / Runs all tests.
33
+ int main ();
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ void testing_v1::verify(bool ok) {
14
14
}
15
15
16
16
class testing_v1 ::Private::Static {
17
- friend void run_all ();
17
+ friend int ::main ();
18
18
friend class test_base_t ;
19
19
20
20
using tests_t = std::vector<test_base_t *>;
@@ -30,8 +30,6 @@ class testing_v1::Private::Static {
30
30
}
31
31
};
32
32
33
- void testing_v1::run_all () { Private::Static::run_all (); }
34
-
35
33
testing_v1::Private::test_base_t::test_base_t () {
36
34
Static::tests ().push_back (this );
37
35
}
@@ -46,6 +44,6 @@ testing_v1::Private::test_base_t::~test_base_t() {
46
44
}
47
45
48
46
int main () {
49
- testing_v1::run_all ();
47
+ testing_v1::Private::Static:: run_all ();
50
48
return 0 ;
51
49
}
You can’t perform that action at this time.
0 commit comments