Skip to content

Commit

Permalink
Add a test to ensure the Log4cxx created thread runs
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-webb committed Nov 20, 2023
1 parent ec7c34f commit f5a47d7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test/cpp/helpers/threadutilitytestcase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ LOGUNIT_CLASS(ThreadUtilityTest)
auto thrUtil = ThreadUtility::instance();
int num_pre = 0;
int num_started = 0;
int num_run = 0;
int num_post = 0;

thrUtil->configureFuncs(
Expand All @@ -82,12 +83,16 @@ LOGUNIT_CLASS(ThreadUtilityTest)
}
);

std::thread t = thrUtil->createThread( LOG4CXX_STR("FooName"), []() {} );
std::thread t = thrUtil->createThread( LOG4CXX_STR("FooName"), [&num_run]()
{
num_run++;
} );

t.join();

LOGUNIT_ASSERT_EQUAL( num_pre, 1 );
LOGUNIT_ASSERT_EQUAL( num_started, 1 );
LOGUNIT_ASSERT_EQUAL( num_run, 1 );
LOGUNIT_ASSERT_EQUAL( num_post, 1 );
}

Expand Down

0 comments on commit f5a47d7

Please sign in to comment.