本文整理汇总了C++中Tester类的典型用法代码示例。如果您正苦于以下问题:C++ Tester类的具体用法?C++ Tester怎么用?C++ Tester使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tester类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_class_SSArray_ctor_dctor_count
// 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");
*/
}
示例2: test_class_SSArray_bracket_op
// 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)");
}
示例3: run_main
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;
}
示例4: test_class_SSArray_copy_assn
// 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");
}
示例5: test_class_KSArray_types
// 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");
}
示例6: main
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;
}
示例7: test_class_SSArray_ctor_from_size_and_val
// 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");
}
示例8: main
int main(){
Tester test;
test.otworzPlik();
test.symulacja();
test.zamknijPlik();
return 0;
}
示例9: Tester
void TestPage::doubleClick (QListBoxItem *item)
{
if (! item)
return;
Tester *dialog = new Tester(item->text(), chartIndex);
dialog->show();
}
示例10: test_class_SSArray_equality_comparisons
// 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");
}
示例11: main
int main( int argc, char **argv )
{
QApplication app( argc, argv );
Tester t;
t.test();
return 0;
}
示例12: main
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 );
}
示例13: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Tester w;
QApplication::setApplicationName("widgetKeyboard");
w.show();
return app.exec();
}
示例14: main
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;
}
示例15: test_resto_divisao_maior
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();
}