int main() { const static size_t N = 10; const size_t COL_WIDTH = 20; std::cout << std::setw(COL_WIDTH) << "Quantity"; std::cout << std::setw(COL_WIDTH) << "findNSmallest"; std::cout << std::setw(COL_WIDTH) << "findNSmallest2"; std::cout << std::endl; size_t quant = 100; for (size_t i = 0; i < 10; ++i) { std::default_random_engine generator(1234); std::normal_distribution<double> distribution(5.0, 2.0); std::function<double()> rnd = std::bind(distribution, generator); std::vector<double> input(quant); std::generate_n(input.begin(), input.size(), rnd); std::cout << std::setw(COL_WIDTH) << quant; std::cout << std::setw(COL_WIDTH) << harness(input, N, findNSmallest<std::vector<double>::const_iterator, std::vector<double>::iterator>) << " "; std::cout << std::setw(COL_WIDTH) << harness(input, N, findNSmallest2<std::vector<double>::const_iterator, std::vector<double>::iterator>) << " "; std::cout << std::endl; quant *= 10; } return 0; }
int main(int argc, char **argv) { std::string key_dir, test_file_location, url; if (argc > 1) { test_file_location = argv[1]; key_dir = argv[2]; url = argv[3]; } bool isSecure = false; if (url.find("https") != std::string::npos) { isSecure = true; } SiteToSiteTestHarness harness(isSecure); Responder responder(isSecure); harness.setKeyDir(key_dir); harness.setUrl(url, &responder); harness.run(test_file_location); return 0; }
TEST(BidiResolver, BidiTest_txt) { BidiTestRunner runner; // Blink's Unicode Bidi Algorithm (UBA) doesn't yet support the // new isolate directives from Unicode 6.3: // http://www.unicode.org/reports/tr9/#Explicit_Directional_Isolates runner.skipTestsWith(0x2066); // LRI runner.skipTestsWith(0x2067); // RLI runner.skipTestsWith(0x2068); // FSI runner.skipTestsWith(0x2069); // PDI // This code wants to use PathService from base/path_service.h // but we aren't allowed to depend on base/ directly from Blink yet. // Alternatively we could use: // blink::Platform::current()->unitTestSupport()->webKitRootDir() // and a relative path, but that would require running inside // webkit_unit_tests (to have a functioning Platform object). // The file we want is: // src/third_party/icu/source/test/testdata/BidiTest.txt // but we don't have any good way to find it from this unittest. // Just assume we're running this test manually for now. On the // bots we just print a warning that we can't find the test file. std::string bidiTestPath = "BidiTest.txt"; std::ifstream bidiTestFile(bidiTestPath.c_str()); if (!bidiTestFile.is_open()) { printf("ERROR: Failed to open BidiTest.txt, cannot run tests.\n"); return; } bidi_test::Harness<BidiTestRunner> harness(runner); harness.parse(bidiTestFile); bidiTestFile.close(); if (runner.m_testsSkipped) printf("WARNING: Skipped %zu tests.\n", runner.m_testsSkipped); printf("Ran %zu tests: %zu level failures %zu order failures.\n", runner.m_testsRun, runner.m_levelFailures, runner.m_orderFailures); // The unittest harness only pays attention to GTest output, so we verify // that the tests behaved as expected: EXPECT_EQ(352098u, runner.m_testsRun); EXPECT_EQ(418143u, runner.m_testsSkipped); EXPECT_EQ(0u, runner.m_ignoredCharFailures); EXPECT_EQ(44882u, runner.m_levelFailures); EXPECT_EQ(19151u, runner.m_orderFailures); }
TEST(HomogeneousPointTestSuite, testHpoints) { sm::PointTestHarness<sm::kinematics::HomogeneousPoint> harness(1e-6); harness.testAll(); }