コード例 #1
0
ファイル: Runner.cpp プロジェクト: ronaldosvieira/ant-colony
int main(int argc, char **argv) {
	srand(time(NULL));

	if (TEST) runSuite();
	else {
		try {run();}
		catch (std::exception &e) {
			std::cout << "Error: " << e.what() << "\n";
		}
	}
}
コード例 #2
0
/** Main program.
 * @return 0 in case all tests ran successfully, otherwise 1.
 */
int main(void) {
    int retVal = 0;
    runSuite(&suite1);
    if (runnerData->testCaseFailureCount != TEST_FAILURES_FOR_VERIFICATION) {
        fprintf(stderr, "Error: %d test cases failed, expected %d test cases to fail.\n", (int) runnerData->testCaseFailureCount, (int) TEST_FAILURES_FOR_VERIFICATION);
        retVal = 1;
    }
#ifdef TEST_CASES_FOR_VERIFICATION
    if (runnerData->testCaseCount != TEST_CASES_FOR_VERIFICATION) {
        fprintf(stderr, "Test Cases: %d but expected %d\n", runnerData->testCaseCount, TEST_CASES_FOR_VERIFICATION);
        retVal = 1;
    }
#endif
    return retVal;
}
コード例 #3
0
ファイル: test.c プロジェクト: GNsunghokim/rtos
int run_test(const char* name) {
	int ret = 0;
	// Run all tests for NULL parameter
	if(name == NULL) {
		// We suppose that there is only one suite
		runSuite(&suite1);

		// Verify all test were executed
		if(runnerData->testCaseCount != TEST_CASES_FOR_VERIFICATION) {
			printf("Test Cases: %d but expected %d\n", (int) runnerData->testCaseCount, TEST_CASES_FOR_VERIFICATION);
			ret = -1;
		}

	} else  {
		bool found = false;
		const TestSuite_t *const *suites = suite1.suites;
		if (suites != NULL) {
			for(; NULL != *suites; suites++) {
				// Find specific test function name from test fixtures
				TestFixture_t* fixture = (TestFixture_t*)*suites;

				if(!strncmp(fixture->name, name, strlen(name))) {
					runFixture(fixture, NULL);
					found = true;
					break;
				} 
			}
		}

		if(!found) {
			printf("Cannot find requested test : [%s]\n", name);
			return -2;
		}
	}

	if(runnerData->testCaseFailureCount != 0) 
		ret = -3;

	printf("Test Cases: %d  Success: %d  Errors: %d\n", (int)runnerData->testCaseCount,
		       	(int)runnerData->testCaseCount - runnerData->testCaseFailureCount,
			(int)runnerData->testCaseFailureCount);

	runnerData->testCaseCount = 0;
	runnerData->testCaseFailureCount = 0;

	return ret;
}
コード例 #4
0
ファイル: AceUnitMainHosted.c プロジェクト: nelkinda/aceunit
/** Main program.
 * @param argc
 *      Number of command line arguments.
 * @param argv
 *      Command line arguments.
 *      The first optional argument is a number of expected test cases to fail, which defaults to zero.
 *      The second optional argument is a number of expected test cases in total.
 * @return 0 in case all tests ran successfully, otherwise 1.
 */
int main(int argc, char *argv[])
{
    struct arguments arguments = { 0, 0 };

    argp_parse(&argp, argc, argv, 0, 0, &arguments);

    if (optind >= argc)
        runSuite(&suite1);
    else
        runSuitesFromIds(argc - optind, &argv[optind]);

    if (arguments.expectedTestCaseFailureCount != runnerData->testCaseFailureCount)
        errx(EXIT_FAILURE, "expected failed test cases: %d; actual failed test cases: %" PRId16, arguments.expectedTestCaseFailureCount, runnerData->testCaseFailureCount);
    if ((arguments.expectedTestCaseCount != 0) && (arguments.expectedTestCaseCount != runnerData->testCaseCount))
        errx(EXIT_FAILURE, "expected test cases: %d; actual test cases: %" PRId16, arguments.expectedTestCaseCount, runnerData->testCaseCount);

    return EXIT_SUCCESS;
}
コード例 #5
0
ファイル: testdriver.c プロジェクト: mantauav/paparazzi
int main()
{
  int retcode = 0;
  
  struct testcase testcases[] = {
    TESTCASE(tgps_nmea_nextField),
    TESTCASE(tgps_nmea_checksum),
    TESTCASE(tgps_nmea_GPGSA),
    TESTCASE(tgps_nmea_GPRMC),
    TESTCASE(tgps_nmea_GPGGA),
    TESTCASE(tgps_nmea_GPGSV),
  };
  
  /* initialize things */
  
  /* run test suite on the airborne code */
  retcode = runSuite((char*)"airborne_test_results.xml",
		     (char*)"airborne",
		     testcases,
		     sizeof(testcases)/sizeof(testcases[0]));
  
  return (retcode == 0) ? 0 : -1;
}
コード例 #6
0
ファイル: Test.cpp プロジェクト: ksorokosz/DSP-Library
int main()
{
    runSuite();
    return 0;
}
コード例 #7
0
ファイル: TestSayHello.cpp プロジェクト: MattPD/Prog3
int main(){
    runSuite();
}
コード例 #8
0
ファイル: main.cpp プロジェクト: LeiDai/agros2d
int main(int argc, char *argv[])
{
    try
    {
        // command line info
        TCLAP::CmdLine cmd("Agros2D solver", ' ', versionString().toStdString());

        TCLAP::SwitchArg logArg("l", "enable-log", "Enable log", false);
        TCLAP::SwitchArg remoteArg("r", "remote-server", "Run remote server", false);
        TCLAP::ValueArg<std::string> problemArg("p", "problem", "Solve problem", false, "", "string");
        TCLAP::ValueArg<std::string> scriptArg("s", "script", "Solve script", false, "", "string");
        TCLAP::ValueArg<std::string> testArg("t", "test", "Run tests", false, "list", "string");

        cmd.add(logArg);
        cmd.add(remoteArg);
        cmd.add(problemArg);
        cmd.add(scriptArg);
        cmd.add(testArg);

        // parse the argv array.
        cmd.parse(argc, argv);

        CleanExit cleanExit;
        AgrosSolver a(argc, argv);

        // enable log
        a.setEnableLog(logArg.getValue());

        // run remote server
        if (remoteArg.getValue())
        {
            a.runRemoteServer();
            return a.exec();
        }

        if (!problemArg.getValue().empty())
        {
            if (QFile::exists(QString::fromStdString(problemArg.getValue())))
            {
                QFileInfo info(QString::fromStdString(problemArg.getValue()));
                if (info.suffix() == "a2d")
                {
                    a.setFileName(QString::fromStdString(problemArg.getValue()));
                    QTimer::singleShot(0, &a, SLOT(solveProblem()));
                    return a.exec();
                }
                else
                {
                    std::cout << QObject::tr("Unknown suffix.").toStdString() << std::endl;
                    return 1;
                }
            }
        }
        else if (!scriptArg.getValue().empty())
        {
            if (QFile::exists(QString::fromStdString(scriptArg.getValue())))
            {
                QFileInfo info(QString::fromStdString(scriptArg.getValue()));
                if (info.suffix() == "py")
                {
                    a.setFileName(QString::fromStdString(scriptArg.getValue()));
                    QTimer::singleShot(0, &a, SLOT(runScript()));
                    return a.exec();
                }
                else
                {
                    std::cout << QObject::tr("Unknown suffix.").toStdString() << std::endl;
                    return 1;
                }
            }
        }
        else if (!testArg.getValue().empty())
        {
            if (QString::fromStdString(testArg.getValue()) == "list")
            {
                QTimer::singleShot(0, &a, SLOT(printTestSuites()));
            }
            else
            {
                a.setScriptSuite(QString::fromStdString(testArg.getValue()));
                QTimer::singleShot(0, &a, SLOT(runSuite()));
            }
            return a.exec();
        }
        else
        {
            return 1;
        }
    }
    catch (TCLAP::ArgException &e)
    {
        std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl;
        return 1;
    }
}
コード例 #9
0
ファイル: unit_test_system.cpp プロジェクト: astrellon/Rouge
    void UnitTestSystem::init()
    {
        GameSystem::init();
        
        gfx::GfxEngine *gfxEngine = gfx::GfxEngine::getEngine();
        float screenWidth = static_cast<float>(gfxEngine->getScreenWidth());
        float screenHeight = static_cast<float>(gfxEngine->getScreenHeight());

        mDebugConsole->setMaxEntries(100);

        mDebugConsole->setVisible(true);

        int suiteCount = 0;

        runSuite(tests::TestBase);
        runSuite(tests::TestMouseManager);
        runSuite(tests::TestMap);
        runSuite(tests::TestCharacter);
        runSuite(tests::TestLua);
        runSuite(tests::TestLuaQuest);
        runSuite(tests::TestLuaEventListener);
        runSuite(tests::TestLuaCharacter);
        runSuite(tests::TestLuaStats);
        runSuite(tests::TestLuaStatModifiers);
        runSuite(tests::TestLuaItem);
        runSuite(tests::TestLuaInventory);
        runSuite(tests::TestLuaTileType);
        runSuite(tests::TestLuaTile);
        runSuite(tests::TestLuaTileSet);
        runSuite(tests::TestLuaEngine);
        runSuite(tests::TestLevelable);
        runSuite(tests::TestDialogue);
        runSuite(tests::TestLuaDialogue);
        runSuite(tests::TestEventInterface);
        runSuite(tests::TestLuaMap);
        runSuite(tests::TestItem);
        runSuite(tests::TestPathTokeniser);
        runSuite(tests::TestUtilData);
        runSuite(tests::TestLuaDataTable);
        runSuite(tests::TestUtils);
        runSuite(tests::TestBodyParts);
        runSuite(tests::TestLuaAsset);
        runSuite(tests::TestStore);
        runSuite(tests::TestLuaStore);
        runSuite(tests::TestTransform);

        const std::vector<std::string> &failed = tests::TestSuite::getFailedTests();
        if (failed.size() > 0)
        {
            std::stringstream ss;
            ss << "-------------------\nFailed tests: ";
            std::vector<std::string>::const_iterator iter;
            bool first = true;
            for (iter = failed.begin(); iter != failed.end(); ++iter)
            {
                if (!first)
                {
                    ss << ", ";
                }
                first = false;
                ss << iter->c_str();
            }
            ss << "\n-------------------";
            am_log("FAILED", ss);
        }
        else
        {
            std::stringstream ss;
            ss << "-------------------\nAll ";
            ss << suiteCount << " tests passed!";
            ss << "\n-------------------";
            am_log("PASSED", ss);
        }
    }
コード例 #10
0
ファイル: greyboxtest.c プロジェクト: devent/rsscon
int main() {
	Suite *s = createRssconSuite();
	int ret = runSuite(s, false);
	return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}