Unit testing update:
- Verbosity is now honored globally - Added BTestCase::Outputf() - Migrated BNode, BStatable, BDirectory, and BPath tests - Added CommonTestLib, TestLib, and R5TestLib rules to Jamrules - Updated Jamfiles for unit testing stuff - Probably a few other things I've forgotten git-svn-id: file:///srv/svn/repos/haiku/trunk/current@269 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -20,22 +20,22 @@ ExampleTest::Suite() {
|
||||
|
||||
// Add a multithreaded test
|
||||
ExampleTest *test = new ExampleTest("This name is never used, just so you know :-)");
|
||||
caller = new BThreadedTestCaller<ExampleTest>("MultiThreaded Test #1", test);
|
||||
caller = new BThreadedTestCaller<ExampleTest>("ExampleTests::MultiThreaded Test #1", test);
|
||||
caller->addThread("A", &ExampleTest::TestFunc1);
|
||||
caller->addThread("B", &ExampleTest::TestFunc2);
|
||||
caller->addThread("C", &ExampleTest::TestFunc3);
|
||||
suite->addTest(caller);
|
||||
|
||||
// And another
|
||||
caller = new BThreadedTestCaller<ExampleTest>("MultiThreaded Test #2");
|
||||
caller = new BThreadedTestCaller<ExampleTest>("ExampleTests::MultiThreaded Test #2");
|
||||
caller->addThread("Thread1", &ExampleTest::TestFunc1);
|
||||
caller->addThread("Thread2", &ExampleTest::TestFunc1);
|
||||
caller->addThread("Thread3", &ExampleTest::TestFunc1);
|
||||
suite->addTest(caller);
|
||||
|
||||
// And some single threaded ones
|
||||
suite->addTest(new CppUnit::TestCaller<ExampleTest>("SingleThreaded Test #1", &ExampleTest::TestFunc1));
|
||||
suite->addTest(new CppUnit::TestCaller<ExampleTest>("SingleThreaded Test #2", &ExampleTest::TestFunc2));
|
||||
suite->addTest(new CppUnit::TestCaller<ExampleTest>("ExampleTests::SingleThreaded Test #1", &ExampleTest::TestFunc1));
|
||||
suite->addTest(new CppUnit::TestCaller<ExampleTest>("ExampleTests::SingleThreaded Test #2", &ExampleTest::TestFunc2));
|
||||
|
||||
return suite;
|
||||
}
|
||||
@@ -48,10 +48,10 @@ ExampleTest::TestFunc1() {
|
||||
// Get the lock and do our business
|
||||
NextSubTest();
|
||||
fLocker->Lock();
|
||||
// printf("TestFunc1() -- %d + 10 = %d\n", fNum, fNum+10);
|
||||
fNum += 10;
|
||||
fLocker->Unlock();
|
||||
snooze(sleeptime);
|
||||
// Outputf("(1:%d)", i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ ExampleTest::TestFunc2() {
|
||||
// Get the lock and do our business
|
||||
NextSubTest();
|
||||
fLocker->Lock();
|
||||
// printf("TestFunc2() -- %d * 2 = %d\n", fNum, fNum*2);
|
||||
fNum *= 2;
|
||||
fLocker->Unlock();
|
||||
snooze(sleeptime);
|
||||
// Outputf("(2:%d)", i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ ExampleTest::TestFunc3() {
|
||||
// Get the lock and do our business
|
||||
NextSubTest();
|
||||
fLocker->Lock();
|
||||
// printf("TestFunc3() -- %d - 5 = %d\n", fNum, fNum-5);
|
||||
fNum += 10;
|
||||
fLocker->Unlock();
|
||||
snooze(sleeptime);
|
||||
// Outputf("(3:%d)", i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user