// test_class_SSArray_ctor_dctor_count
// Test suite for class template SSArray, number of class to item type
//  ctor, dctor.
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate messages have been printed to cout.
// Does not throw (No-Throw Guarantee)
void test_class_SSArray_ctor_dctor_count(Tester & t)
{
    std::cout << "Test Suite: class template SSArray - ctor, dctor count"
              << std::endl;

    // Check number of value type ctor/dctor calls
    //  on array creation & destruction
    Counter::reset();
    { // Block, so we get dctor calls before function ends
        const SSArray<Counter> tacc(10);

        t.test(Counter::getCtorCount() == 10,
          "Counting default ctor calls due to array creation");

        Counter::reset();
    }
    t.test(Counter::getDctorCount() == 10,
      "Counting dctor calls due to destruction");

/*
    // Check correct number of value type ctor & dctor calls
    //  on self-assignment
    SSArray<Counter> tacc2(10);
    Counter::reset();
    tacc2 = tacc2;
    int i1 = Counter::getCtorCount() + Counter::getDctorCount();
    t.test(i1 == 0 || i1 == 20, "Self-assignment ctor/dctor calls");
*/
}
// test_class_SSArray_bracket_op
// Test suite for class Product, bracket operator
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate have been messages printed to cout.
void test_class_SSArray_bracket_op(Tester & t)
{
    std::cout << "Test Suite: class Product, bracket operator" << std::endl;

    const int theSize = 10;
    bool noErrors;  // True if no errors encountered
    int i;          // Counter

    SSArray<int> ssai(theSize);
    for (i = 0; i < theSize; ++i)
        ssai[i] = 15 - i * i;

    noErrors = true;
    for (i = 0; i < theSize; ++i)
    {
        if (ssai[i] != 15 - i * i)
            noErrors = false;
    }
    t.test(noErrors, "Bracket operator (non-const)");

    // Make const version, no copy
    const SSArray<int> & ssaiRef = ssai;

    noErrors = true;
    for (i = 0; i < theSize; ++i)
    {
        if (ssaiRef[i] != 15 - i * i)
            noErrors = false;
    }
    t.test(noErrors, "Bracket operator (const)");
}
int
run_main (int, ACE_TCHAR *[])
{
    ACE_START_TEST (ACE_TEXT ("RMCast_Retransmission_Test"));

    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("This is ACE Version %u.%u.%u\n\n"),
                ACE::major_version(),
                ACE::minor_version(),
                ACE::beta_version()));

    {
        ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Running single threaded test\n")));
        //! Run the test in single threaded mode
        Tester tester;
        tester.run (100);
        tester.validate_message_count ();
    }
    {
        ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Running multi threaded test\n")));
        //! Run the test in multi-threaded mode
        Tester tester;
        Task task (&tester);
        if (task.activate (THR_NEW_LWP|THR_JOINABLE, 4) == -1)
            ACE_ERROR_RETURN ((LM_ERROR,
                               ACE_TEXT ("Cannot activate the threads\n")),
                              1);
        ACE_Thread_Manager::instance ()->wait ();
        tester.validate_message_count ();
    }

    ACE_END_TEST;
    return 0;
}
// test_class_SSArray_copy_assn
// Test suite for class SSArray, copy assignment
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate have been messages printed to cout.
void test_class_SSArray_copy_assn(Tester & t)
{
    std::cout << "Test Suite: class SSArray - copy assignment" << std::endl;

    const int theSize = 10;
    bool noErrors;  // True if no errors encountered
    int i;          // Counter

    SSArray<int> ssai(theSize);
    for (i = 0; i < theSize; ++i)
        ssai[i] = 15 - i * i;

    // Make const version, no copy
    const SSArray<int> & ssaiRef = ssai;
    // Make copy (copy assignment)
    SSArray<int> ssaiCopy(1);
    ssaiCopy = ssaiRef;

    t.test(ssaiCopy.size() == theSize, "Copy assignment - check size");

    noErrors = true;
    for (i = 0; i < theSize; ++i)
    {
        if (ssaiCopy[i] != 15 - i * i)
            noErrors = false;
    }
    t.test(noErrors, "Copy assignment - check values");
}
// test_class_KSArray_types
// Test suite for class KSArray, types
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate messages have been printed to cout.
// Does not throw (No-Throw Guarantee)
void test_class_KSArray_types(Tester & t)
{
    std::cout << "Test Suite: class KSArray - types" << std::endl;

    bool correctType;  // result of type checking

    // value_type test #1: int
    KSArray<int>::value_type i1 = 0;
    correctType = TypeCheck<int>::check(i1);
    t.test(correctType, "value_type test #1");

    // value_type test #2: double
    KSArray<double>::value_type d1 = 0.;
    correctType = TypeCheck<double>::check(d1);
    t.test(correctType, "value_type test #2");

    // value_type check modifiability (only needs to compile)
    KSArray<double>::value_type d2;
    d2 = 0.;
    t.test(true, "value_type check modifiability");

    // size_type test
    KSArray<Counter>::size_type s1 = 0;
    correctType = TypeCheck<std::size_t>::check(s1)
                  || TypeCheck<std::ptrdiff_t>::check(s1);
    t.test(correctType, "size_type test");

    // size_type check modifiability (only needs to compile)
    KSArray<Counter>::size_type s2;
    s2 = 0;
    t.test(true, "size_type check modifiability");
}
int main(int argc, char* argv[])
{
   // default configuration filename
   std::string configFilename = "test01.edl";

   // parse arguments
   for (int i = 1; i < argc; i++) {
      if ( std::string(argv[i]) == "-f" ) {
         configFilename = argv[++i];
      }
   }

   // build tester
   Tester* tester = builder(configFilename);

   // create the thread
   TimerThread* thread = createTheThread(tester);
   if (thread != nullptr) {

      // run the test
      run(tester);

      tester->event(oe::base::Component::SHUTDOWN_EVENT);
      tester->unref();
      tester = nullptr;

      // stop the thread
      thread->terminate();
      thread->unref();
      thread = nullptr;
   }

   return 0;
}
// test_class_SSArray_ctor_from_size_and_val
// Test suite for class template SSArray, ctor from size & value
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate have been messages printed to cout.
// Does not throw (No-Throw Guarantee)
void test_class_SSArray_ctor_from_size_and_val(Tester & t)
{
    std::cout << "Test Suite: class template SSArray - "
              << "ctor from size & value"
              << std::endl;

    const int theSize = 1000;
    bool noErrors;  // True if no errors encountered
    const double val = -3.2;

    SSArray<double> tad(theSize, val);

    // check size
    t.test(tad.size() == theSize, "Ctor from size & value - check size");

    // check values
    typedef SSArray<double>::size_type ST;
    noErrors = true;
    for (auto i = static_cast<ST>(0);
         i < tad.size();
         ++i)
    {
        if (tad[i] != val)
            noErrors = false;
    }
    t.test(noErrors, "Ctor from size & value - check values");
}
Example #8
0
int main(){
	Tester test;
	test.otworzPlik();
	test.symulacja();
	test.zamknijPlik();
	return 0;

}
Example #9
0
void TestPage::doubleClick (QListBoxItem *item)
{
  if (! item)
    return;
    
  Tester *dialog = new Tester(item->text(), chartIndex);
  dialog->show();
}
// test_class_SSArray_equality_comparisons
// Test suite for class template SSArray, comparisons ==, !=
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate messages have been printed to cout.
// Does not throw (No-Throw Guarantee)
void test_class_SSArray_equality_comparisons(Tester & t)
{
    std::cout << "Test Suite: class template SSArray - "
              << "equality comparisons"
              << std::endl;

    bool correctType;  // result of type checking

    const int theSize = 10;
    int i;          // Counter

    SSArray<int> tai1(theSize);
    for (i = 0; i < theSize; ++i)
        tai1[i] = 15 - i * i;
    const SSArray<int> & tai1Ref = tai1;
    SSArray<int> tai1Copy(tai1Ref);
    SSArray<int> tai2(theSize-1);
    for (i = 0; i < theSize-1; ++i)
        tai2[i] = 15 - i * i;
    const SSArray<int> & tai2Ref = tai2;
    
    // operator== return type
    correctType = TypeCheck<bool>::check(tai1 == tai1Copy);
    t.test(correctType, "operator==, return type");

    // operator!= return type
    correctType = TypeCheck<bool>::check(tai1 != tai1Copy);
    t.test(correctType, "operator!=, return type");

    // Check equality of copies
    t.test(tai1 == tai1Copy, "Equality of copies");

    // Check inequality of copies
    t.test(!(tai1 != tai1Copy), "Inequality of copies");

    // Check equality of different sizes #1
    //  (compilation checks constness of op==)
    t.test(!(tai1Ref == tai2Ref), "Equality of different sizes #1");

    // Check inequality of different sizes #1
    //  (compilation checks constness of op!=)
    t.test(tai1Ref != tai2Ref, "Inequality of different sizes #1");

    // Check equality of different sizes #2
    t.test(!(tai2Ref == tai1Ref), "Equality of different sizes #2");

    // Check inequality of different sizes #2
    t.test(tai2Ref != tai1Ref, "Inequality of different sizes #2");

    // Modify copy
    ++tai1Copy[theSize-1];

    // Check equality of modification of copy
    t.test(!(tai1 == tai1Copy), "Equality of modification of copy");

    // Check inequality of modification of copy
    t.test(tai1 != tai1Copy, "Inequality of modification of copy");
}
Example #11
0
void test_resto_divisao_maior()
{
    t.open("resto_divisao_maior", 1);
    t.add(resto_divisao_maior(5,2) == 1);
    t.add(resto_divisao_maior(10,3) == 1);
    t.add(resto_divisao_maior(3,5) == 2);
    t.add(resto_divisao_maior(4,6) == 2);
    t.close();
}
Example #12
0
void test_a_eh_maior()
{
    t.open("a_eh_maior", 1);
    t.add(a_eh_maior(1,3,5) == false);
    t.add(a_eh_maior(3,2,1) == true);
    t.add(a_eh_maior(2,3,7) == false);
    t.add(a_eh_maior(5,7,1) == false);
    t.close();
}
Example #13
0
void test_resto_divisao()
{
    t.open("resto_divisao", 1);
    t.add(resto_divisao(5,2) == 1);
    t.add(resto_divisao(10,2) == 0);
    t.add(resto_divisao(8,5) == 3);
    t.add(resto_divisao(6,4) == 2);
    t.close();
}
Example #14
0
void test_valor_maximo2()
{
    t.open("valor_maximo2", 1);
    t.add(valor_maximo2(1,3) == 3);
    t.add(valor_maximo2(3,2) == 3);
    t.add(valor_maximo2(2,3) == 3);
    t.add(valor_maximo2(5,7) == 7);
    t.close();
}
Example #15
0
int main( int argc, char **argv )
{
  QApplication app( argc, argv );
  
  Tester t;
  t.test();
  
  return 0;
}
Example #16
0
File: main.cpp Project: CCJY/coliru
int main() { 
    Tester<500> t;                                                                                                                                                                                                                 
    char * ptr  = t.getPtr();                                                                                                                                                                                                      
    char * buf = t.getBuf();                                                                                                                                                                                                       

    std::cout << "'" << (void*)ptr << std::endl;
    std::cout << "'" << (void*)buf << std::endl;
    assert( buf == ptr );                                                                                                                                                                                                          
}                                                                                                                                                                                                                                  
Example #17
0
int main(int argc, char *argv[])
{
    QApplication    app(argc, argv);
    Tester          w;

    QApplication::setApplicationName("widgetKeyboard");    
	w.show();
	return app.exec();
}
Example #18
0
void test_operacao2()
{
    t.open("operacao2", 2);
    t.add(operacao2(4,2) == 0);
    t.add(operacao2(5,3) == 5);
    t.add(operacao2(8,5) == 12);
    t.add(operacao2(21,4) == 21);
    t.add(operacao2(17,6) == 85);
    t.close();
}
Example #19
0
int main(int arc, char** argv)
{
  iris::glog<iris::Warning>("Global Test");
  iris::glog<iris::Warning>("Global Test 2",
                            "Arg1", iris::arg<int>(5));

  Tester t;
  t.doit();
  return 0;
}
Example #20
0
void test_eh_sobra31_div5()
{

    t.open("eh_sobra31_div5",1);
    t.add(eh_sobra31_div5(10) == true);
    t.add(eh_sobra31_div5(15) == false);
    t.add(eh_sobra31_div5(19) == false);
    t.add(eh_sobra31_div5(25) == true);
    t.close();
}
Example #21
0
int main()
{
  std::cout << "1 == 0 ? " << equal(1, 0) << std::endl;
  std::cout << "1 == 1 ? " << equal(1, 1) << std::endl;
    
  Tester<int>     iT;
    
  std::cout << "41 == 42 ? " << iT.equal(41, 42) << std::endl;
  std::cout << "42 == 42 ? " << iT.equal(42, 42) << std::endl;
  return 0;
}
Example #22
0
void CompositeTest::action(Tester& t)
{
  t.preTests(*this);

  for (std::list<Test*>::iterator i = m_tests.begin(); i != m_tests.end(); ++i)
    {
      (*i)->action(t);
    }

  t.postTests(*this);
}
// test_class_SSArray_bracket_op
// Test suite for class template SSArray, bracket operator
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate messages have been printed to cout.
// Does not throw (No-Throw Guarantee)
void test_class_SSArray_bracket_op(Tester & t)
{
    std::cout << "Test Suite: class template SSArray, bracket operator"
              << std::endl;

    bool correctType;  // result of type checking

    const int theSize = 10;
    bool noErrors;  // True if no errors encountered
    int i;          // Counter

    SSArray<double> tad1;
    correctType = TypeCheck<SSArray<double>::value_type>::check(tad1[1]);
    t.test(correctType, "Bracket operator (non-const), return type");

    SSArray<int> tai(theSize);
    for (i = 0; i < theSize; ++i)
        tai[i] = 15 - i * i;

    noErrors = true;
    for (i = 0; i < theSize; ++i)
    {
        if (tai[i] != 15 - i * i)
            noErrors = false;
    }
    t.test(noErrors, "Bracket operator (non-const) #1");

    tai[2] = 1000;
    noErrors = true;
    for (i = 0; i < theSize; ++i)
    {
        if (tai[i] != ((i == 2) ? 1000 : 15 - i * i))
            noErrors = false;
    }
    t.test(noErrors, "Bracket operator (non-const) #2");

    // Make const version, no copy
    const SSArray<int> & taiRef = tai;

    const SSArray<double> tad2;
    correctType = TypeCheck<SSArray<double>::value_type>::check(tad2[1]);
    t.test(correctType, "Bracket operator (const), return type");

    noErrors = true;
    for (i = 0; i < theSize; ++i)
    {
        if (taiRef[i] != ((i == 2) ? 1000 : 15 - i * i))
            noErrors = false;
    }
    t.test(noErrors, "Bracket operator (const)");

}
int _tmain(int argc, _TCHAR* argv[])
{
    CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    Tester tester;

    tester.Test(TestTextEncoding, "TextEncoding");

    tester.WriteResults();

    CoUninitialize();

    return 0;
}
// test_class_SSArray_size_and_ctor_from_size
// Test suite for class SSArray, function size and ctor from size
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate have been messages printed to cout.
void test_class_SSArray_size_and_ctor_from_size(Tester & t)
{
    std::cout << "Test Suite: class SSArray - function size, ctor from size" << std::endl;

    const SSArray<int> ssai(10);
    t.test(ssai.size() == 10, "size, ctor from size (const) #1");

    const SSArray<double> ssad(100);
    t.test(ssad.size() == 100, "size, ctor from size (const) #2)");

    SSArray<int> ssai2(20);
    t.test(ssai2.size() == 20, "size, ctor from size (non-const)");
}
Example #26
0
int main(int argc, char **argv)
{
	Tester t;
	t.InitTests();
	t.RunTests();
	
	float tx, ty;
	BMU::OrthogonalProjectionOfPointOnCircle(7.5f, 2.5f, 2.5f, 6.f, 3.f, tx, ty);
	
	printf("\n\n%.2f %.2f", tx, ty);
	
	return 0;
}
Example #27
0
int main(int argc, char** argv) {
	VerboseType vType = ALL;
	int numRuns = 10;
	std::string rootTestFileName = "testFile";
	Lexer* testLexer = NULL;
	
	std::cout << "------------ Lexer Tester -------------" << std::endl;
	std::cout << "CS480: campbcha, wadec, zoonb, piorkowd" << std::endl << std::endl;
	std::cout << "Running " << numRuns << " tests" << std::endl;
	if ( vType == ALL ) {
		std::cout << "PRINTING ALL MESSAGES";
	} else if ( vType == ERRORS ) {
		std::cout << "PRINTING ONLY ERRORS";
	} else if ( vType == NONE ) {
		std::cout << "PRINTING NO MESSAGES";
	} else {
		std::cout << "VERBOSE ERROR";
	}
	std::cout << std::endl << std::endl;

	for ( int i = 1 ; i <= numRuns; i++ ) {
		Tester myTester;
		std::stringstream out;

		std::cout << "--------------------------------" << std::endl;
		std::cout << "Start test " << i << std::endl;
		
		out << rootTestFileName << i << ".txt";
		std::string testFileName = out.str();
		try {
			myTester.generateTestFile(testFileName);
			testLexer = new Lexer(testFileName.c_str());
			myTester.run(testLexer, vType);
		} catch (Exception e) {
			e.print();
		}

		if ( testLexer != NULL ) {
			delete testLexer;
			testLexer = NULL;
		}
		std::cout << "Test " << i << " done" << std::endl;
		std::cout << "--------------------------------" << std::endl;
#ifdef _WIN32
		Sleep(1000);
#else
		sleep(1);
#endif
	}
	return 0;
}
// test_class_KSArray_begin_end
// Test suite for class KSArray, functions begin & end
// Pre: None.
// Post:
//     Pass/fail status of tests have been registered with t.
//     Appropriate messages have been printed to cout.
// Does not throw (No-Throw Guarantee)
void test_class_KSArray_begin_end(Tester & t)
{
    std::cout << "Test Suite: class KSArray - functions begin & end" << std::endl;

    bool correctType;  // result of type checking

    const int theSize = 10;
    bool noErrors;      // True if no errors encountered
    int i;              // Counter
    int * iter;         // iterator
    const int * citer;  // const_iterator

    KSArray<int> tai(theSize);
    for (iter = tai.begin(), i = 0; iter != tai.end(); ++iter, ++i)
        *iter = 15 - i * i;

    // Non-const test
    KSArray<double> tad1;

    correctType = TypeCheck<KSArray<double>::value_type *>::check(tad1.begin());
    t.test(correctType, "begin (non-const), return type");

    correctType = TypeCheck<KSArray<double>::value_type *>::check(tad1.end());
    t.test(correctType, "end (non-const), return type");

    t.test(tai.begin() != tai.end(), "begin/end - inequality (non-const)");
    t.test (tai.end() - tai.begin() == theSize, "begin/end - check difference (non-const)");
    noErrors = true;
    for (iter = tai.begin(), i = 0; iter != tai.end(); ++iter, ++i)
    {
        if (*iter != 15 - i * i)
            noErrors = false;
    }
    t.test(noErrors, "begin/end - check values (non-const)");

    // Make const version, no copy
    const KSArray<int> & taiRef = tai;

    // Const test
    const KSArray<double> tad2;

    correctType = TypeCheck<const KSArray<double>::value_type *>::check(tad2.begin());
    t.test(correctType, "begin (const), return type");

    correctType = TypeCheck<const KSArray<double>::value_type *>::check(tad2.end());
    t.test(correctType, "end (const), return type");

    t.test(taiRef.end() - taiRef.begin() == theSize, "begin/end - check difference (const)");
    noErrors = true;
    for (citer = taiRef.begin(), i = 0; citer != taiRef.end(); ++citer, ++i)
    {
        if (*citer != 15 - i * i)
            noErrors = false;
    }
    t.test(noErrors, "begin/end - check values (const)");
}
// main
// Runs class SSArray test suite, prints results to cout.
int main()
{
    Tester t;
    test_class_SSArray(t);

    std::cout << std::endl;
    if (t.allPassed())
        std::cout << "All tests successful" 
                  << std::endl;
    else
        std::cout << "Tests ********** UNSUCCESSFUL **********"
                  << std::endl;
    std::cout << std::endl;
}
Example #30
0
void Invocation::runTesting() {
	cout << endl;
	Tester * curTest = new Tester(params, info);
	int testsCount = params->getTestsCount();
	if (!params->getInputFileMask()->getDigitsCount() || !params->getOutputFileMask()->getDigitsCount()) testsCount = 1;
	ERROR_CODE errorCode = EC_OK;
	OUTCOME_TYPE outcome = OT_UD;
	bool autoDetectTestsNumber = !testsCount;
	for (int test = 1; !testsCount || test <= testsCount; ++test) { 
		errorCode = curTest->runTest(test, autoDetectTestsNumber);
		if (errorCode) {
			delete curTest;
			if (!testsCount && (errorCode == EC_INPUT_DATA_FILE_NOT_FOUND || errorCode == EC_ANSWER_DATA_FILE_NOT_FOUND)) {
				info->setOutcome(OT_AC);
				return;
			}
			printColoredText("Internal Error", CC_LIGHTMAGENTA);
			cout << endl;
			info->setOutcome(OT_IE);
			info->setComment("Test " + toa(test) + ": " + ERROR_MESSAGES[errorCode]);
			outputInfo();
			if (errorCode != EC_CANNOT_TERMINATE_TESTING_PROGRAM && errorCode != EC_CANNOT_TERMINATE_CHECKER) terminate(true, true); else terminate(true, false);
		}
		cout << "Time: ";
		printColoredText(toa(info->getLastTestTime()), CC_LIGHTCYAN);
		cout << " ms  Memory: ";
		int usedMemory = info->getLastTestMemory();
		if (usedMemory < 1000) {
			printColoredText(toa(usedMemory), CC_LIGHTCYAN); 
			cout << " B  ";
		} else
		if (usedMemory < 1000000) {
			printColoredText(toa(usedMemory / 1000), CC_LIGHTCYAN); 
			cout << " KB  ";
		} else {
			printColoredText(toa(usedMemory / 1000000.), CC_LIGHTCYAN); 
			cout << " MB  ";
		}
		outcome = info->getOutcome();
		printColoredText(SHORT_OUTCOME_NAME[outcome], OUTCOME_COLOR[outcome]);
		cout << endl;
		if (outcome != OT_UD) {
			delete curTest;
			return;
		}
	}
	info->setOutcome(OT_AC);
	delete curTest;
}