当前位置: 首页>>代码示例>>C++>>正文


C++ TestSuite::run方法代码示例

本文整理汇总了C++中TestSuite::run方法的典型用法代码示例。如果您正苦于以下问题:C++ TestSuite::run方法的具体用法?C++ TestSuite::run怎么用?C++ TestSuite::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestSuite的用法示例。


在下文中一共展示了TestSuite::run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main() {
	init();

#if defined(USBCON)
	USB.attach();
#endif

#ifndef TESTING
#ifdef USE_SERIAL
	HardwareSerialCommProvider p(9600);
#endif
#ifdef USE_SOCKET
	EthernetSocketCommProvider p(9999);
#endif
#endif

#ifdef TESTING
	MockCommProvider p;
#endif

#ifndef TESTING
	p.open();
	string inst = "";
	while(true) {
		read_and_put(p, inst);
		try_parse(p, inst);
	}
	p.close();

	// while(true) {
	// 	DigitalPin::set(13, 0);
	// 	delay(2);
	// 	DigitalPin::set(13, 1);
	// 	delay(2);
	// }
#endif

#ifdef TESTING
	while(true) {
		suite.run();
	}
#endif

	return 0;
}
开发者ID:Theosis,项目名称:SPIRLe,代码行数:45,代码来源:mycode.cpp

示例2: main

int main(int argc, char** argv) {
  
  /* If there's an argument, load that. Otherwise, load ourself. */
  char const* lib = (argc > 1 ? argv[1] : argv[0]);
  
  /* First, get the list of functions that we should run. */
  unique_ptr<char[]> real_symbol_cmd(new char[std::strlen(symbol_cmd) - 2 +
					      std::strlen(lib) + 1]);
  std::sprintf(real_symbol_cmd.get(), symbol_cmd, lib);
  auto cmd_pipe = make_unique(popen(real_symbol_cmd.get(), "r"), &pclose);
  
  /* Then, build the test suites. */
  char line[256];
  TestSuite root;
  auto self = make_unique(dlopen(lib, RTLD_LAZY | RTLD_GLOBAL), &dlclose);
  if (!self)
    throw runtime_error(string("Could not dlopen() ") + lib);
  auto state_ptr = static_cast<DTest::State**>(dlsym(self.get(), "_dtest"));
  if (state_ptr)
    *state_ptr = &DTest::state;
  _dtest = &DTest::state;
  while (std::fgets(line, 255, cmd_pipe.get())) {
    char* space;
    for (space = line; *space != 0 && *space != ' '; ++space);
    if (space == 0)
      throw runtime_error(string("Invalid line: ") + line);
    *space = 0;
    char* i;
    for (i = space + 1; *i != 0 && *i != '\n'; ++i);
    *i = 0;
    root.add_test(space + 1, dltestsym(self.get(), line));
  }
  
  /* And run the test suites. */
  cout<<"Running tests..."<<endl;
  if (root.run())
    return 0;
  return 1;
}
开发者ID:ViktorNova,项目名称:dino,代码行数:39,代码来源:dtest.cpp

示例3: main

int main(int argc, char *argv[]) {
    TestSuite suite;
    suite.add("RGBA",new test_rgba());
    suite.add("Image",new test_image());
    suite.add("Image mmap'ed",new test_image_mmap());
    suite.add("Texture",new test_texture());
    suite.add("TGA",new test_tga());
    if (Image::supportsFormat(".png")) {
        suite.add("PNG",new test_png());
    }
    if (Image::supportsFormat(".jpg")) {
        suite.add("JPEG",new test_jpg());
    }
    suite.run();
    suite.printStatus();

    if (suite.hasFailures()) {
	return EXIT_FAILURE;
    } else {
	return EXIT_SUCCESS;
    }
}
开发者ID:thabz,项目名称:RayGay,代码行数:22,代码来源:testimage.cpp

示例4: main

int main(int argc, char** argv) {
    /*
    pthread_cond_t cond;
    pthread_mutex_t mutex;
    
    pthread_mutex_init(&mutex, NULL);
    pthread_cond_init(&cond, NULL);
    
    cout << "zzz" << endl;
    pthread_cond_signal(&cond);
    pthread_cond_wait(&cond, &mutex);
    cout << "teeheee" << endl;
    */
    
    /*pid_t pid = fork();
    if (pid == 0) {
        while(1) {
            sleep(1);
            cout << "child alive" << endl;
        }
    } else if (pid < 0) {
        cout << "fork error" << endl;
    } else {
        while(1) {
            sleep(1);
            cout << "master alive" << endl;
        }
    } */

    TestSuite testSuite;
    testSuite.run();

    Nimble nimble;

    return 0;
}
开发者ID:Gerjo,项目名称:Nimble,代码行数:36,代码来源:main.cpp

示例5: main

int main(int argc, char **argv)
{
    std::string tests_path, file_path;
    static po::variables_map vm;

    /* Specify the valid arguments */
    static po::options_description args("Optional options");

    args.add_options()
        ("test-path,p", po::value<std::string>(&tests_path)->default_value("tests/"),
            "Specify path to testsuite (directory or single file)")
        ("run-tests,t", "Do the testsuite pointed at by tests-path")
        ("file,f", po::value<std::string>(&file_path), "Copy a binary file to memory and start simulation")
        ("help,h", "Help")
    ;

    /* Parse arguments into 'vm' */
    try
    {
        po::store(po::parse_command_line(argc, argv, args), vm);
        po::notify(vm);
    }
    catch (po::error &e)
    {
        std::cerr << e.what() << std::endl;
        std::cout << args << std::endl;
        return 1;
    }

    /* --help */
    if (vm.count("help"))
    {
        std::cout << args << std::endl;
        return 0;
    }

    /* --file */
    if (vm.count("file"))
    {
        Mpu6502 mpu;
        try
        {
            mpu.load_binary_file(file_path, 0);
            mpu.subscribe_to_write(0xF001, 1, Util::std_cout_cb);
            mpu.subscribe_to_read(0xF004, 1, Util::std_getch_cb);

            try
            {
                mpu.run();
            }
            catch (InvalidOpcodeException &e)
            {
                std::cerr << e.what() << std::endl;
                return 1;
            }
            catch (std::exception &e)
            {
                std::cerr << e.what() << std::endl;
                return 1;
            }
        }
        catch (std::exception &e)
        {
            std::cerr << e.what() << std::endl;
            return 1;
        }
    }

    /* --run-tests */
    if (vm.count("run-tests"))
    {
        TestSuite testSuite;
        try
        {
            testSuite.run(tests_path);
        }
        catch (std::exception &e)
        {
            std::cerr << e.what() << std::endl;
            return 1;
        }
    }

    return 0;
}
开发者ID:helgefmi,项目名称:mpu6502,代码行数:85,代码来源:main.cpp

示例6: main

int main(int argc, char** argv)
{
    TestSuite ts;
    Test::TextOutput output(Test::TextOutput::Verbose);
    return ts.run(output, true);
}
开发者ID:sfuller,项目名称:FullMoon,代码行数:6,代码来源:Main.cpp


注:本文中的TestSuite::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。