예제 #1
0
int main(int argc, char *argv[]) {
    TestSuite suite;

    suite.add("Mesh",new test_mesh());
    suite.add("Scheme tests",new schemefunctions_test());
    try {
	suite.run();
    } catch (scheme_exception e) {
	wcerr << e.toString() << endl;    
    }        
    suite.printStatus();
    if (suite.hasFailures()) {
	return EXIT_FAILURE;
    } else {
	return EXIT_SUCCESS;
    }
}
예제 #2
0
파일: mycode.cpp 프로젝트: Theosis/SPIRLe
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;
}
예제 #3
0
파일: dtest.cpp 프로젝트: ViktorNova/dino
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;
}
예제 #4
0
파일: testimage.cpp 프로젝트: thabz/RayGay
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;
    }
}
예제 #5
0
파일: main.cpp 프로젝트: Gerjo/Nimble
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;
}
예제 #6
0
파일: main.cpp 프로젝트: helgefmi/mpu6502
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;
}
예제 #7
0
파일: Main.cpp 프로젝트: sfuller/FullMoon
int main(int argc, char** argv)
{
    TestSuite ts;
    Test::TextOutput output(Test::TextOutput::Verbose);
    return ts.run(output, true);
}