tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Main.cpp (1454B)


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