10 #include <cppunit/TestFixture.h>
11 #include <cppunit/extensions/HelperMacros.h>
22 class regexTest :
public CPPUNIT_NS :: TestFixture {
24 CPPUNIT_TEST (regTest);
26 CPPUNIT_TEST_SUITE_END ();
40 std::string content =
"This is copy of a copyright statement similar to copyleft found in copying";
41 rx::regex matchingRegex (
"copy");
43 std::string::const_iterator begin = content.begin();
44 std::string::const_iterator end = content.end();
45 rx::match_results<std::string::const_iterator> what;
48 while (rx::regex_search(begin, end, what,matchingRegex)) {
50 begin = what[0].second;
53 CPPUNIT_ASSERT_EQUAL (4, nfound);
60 CPPUNIT_TEST_SUITE_REGISTRATION(
regexTest );
Test fixture to test regex accuracy.
void regTest(void)
Test regex on a test string.