git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48636
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
CPPUNIT_TEST_SUITE( AtomicTestCase );
CPPUNIT_TEST( TestNoThread );
CPPUNIT_TEST_SUITE( AtomicTestCase );
CPPUNIT_TEST( TestNoThread );
+ CPPUNIT_TEST( TestDecReturn );
CPPUNIT_TEST( TestTwoThreadsMix );
CPPUNIT_TEST( TestTenThreadsMix );
CPPUNIT_TEST( TestTwoThreadsSeparate );
CPPUNIT_TEST( TestTwoThreadsMix );
CPPUNIT_TEST( TestTenThreadsMix );
CPPUNIT_TEST( TestTwoThreadsSeparate );
CPPUNIT_TEST_SUITE_END();
void TestNoThread();
CPPUNIT_TEST_SUITE_END();
void TestNoThread();
void TestTenThreadsMix() { TestWithThreads(10, IncAndDecMixed); }
void TestTwoThreadsMix() { TestWithThreads(2, IncAndDecMixed); }
void TestTenThreadsSeparate() { TestWithThreads(10, IncOnly); }
void TestTenThreadsMix() { TestWithThreads(10, IncAndDecMixed); }
void TestTwoThreadsMix() { TestWithThreads(2, IncAndDecMixed); }
void TestTenThreadsSeparate() { TestWithThreads(10, IncOnly); }
CPPUNIT_ASSERT( int2 == -10000000 );
}
CPPUNIT_ASSERT( int2 == -10000000 );
}
+void AtomicTestCase::TestDecReturn()
+{
+ wxAtomicInt i(0);
+ wxAtomicInc(i);
+ wxAtomicInc(i);
+ CPPUNIT_ASSERT( i == 2 );
+
+ CPPUNIT_ASSERT( wxAtomicDec(i) > 0 );
+ CPPUNIT_ASSERT( wxAtomicDec(i) == 0 );
+}
+
void AtomicTestCase::TestWithThreads(int count, ETestType testType)
{
wxAtomicInt int1=0;
void AtomicTestCase::TestWithThreads(int count, ETestType testType)
{
wxAtomicInt int1=0;