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