|
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "SanityChecks.h" |
|
7 #include "TestPoint.h" |
|
8 #include "TestScaling.h" |
|
9 #include "TestBugs.h" |
|
10 #ifdef WIN32 |
|
11 #include "TestDrawTargetD2D.h" |
|
12 #endif |
|
13 |
|
14 #include <string> |
|
15 #include <sstream> |
|
16 |
|
17 struct TestObject { |
|
18 TestBase *test; |
|
19 std::string name; |
|
20 }; |
|
21 |
|
22 |
|
23 using namespace std; |
|
24 |
|
25 int |
|
26 main() |
|
27 { |
|
28 TestObject tests[] = |
|
29 { |
|
30 { new SanityChecks(), "Sanity Checks" }, |
|
31 #ifdef WIN32 |
|
32 { new TestDrawTargetD2D(), "DrawTarget (D2D)" }, |
|
33 #endif |
|
34 { new TestPoint(), "Point Tests" }, |
|
35 { new TestScaling(), "Scaling Tests" } |
|
36 { new TestBugs(), "Bug Tests" } |
|
37 }; |
|
38 |
|
39 int totalFailures = 0; |
|
40 int totalTests = 0; |
|
41 stringstream message; |
|
42 printf("------ STARTING RUNNING TESTS ------\n"); |
|
43 for (int i = 0; i < sizeof(tests) / sizeof(TestObject); i++) { |
|
44 message << "--- RUNNING TESTS: " << tests[i].name << " ---\n"; |
|
45 printf(message.str().c_str()); |
|
46 message.str(""); |
|
47 int failures = 0; |
|
48 totalTests += tests[i].test->RunTests(&failures); |
|
49 totalFailures += failures; |
|
50 // Done with this test! |
|
51 delete tests[i].test; |
|
52 } |
|
53 message << "------ FINISHED RUNNING TESTS ------\nTests run: " << totalTests << " - Passes: " << totalTests - totalFailures << " - Failures: " << totalFailures << "\n"; |
|
54 printf(message.str().c_str()); |
|
55 return totalFailures; |
|
56 } |