Ticket #12857: boost_regex_test.cpp

File boost_regex_test.cpp, 1023 bytes (added by Borivoj Kostka <kostka@…>, 6 years ago)

Testing code

Line 
1#include <stdio.h>
2#include "boost/regex.hpp"
3
4int main(int argc, char* argv[])
5{
6 boost::wregex reg_ok( L".*\\.(?i:(docx|doc))" );
7 boost::wregex reg_bad( L".*\\.(?i:(doc|docx))" );
8
9 if ( !boost::regex_match( L"/data/txt/a.DOC", reg_ok ) )
10 printf( "#1 not matched!\n");
11 if ( !boost::regex_match( L"/data/txt/a.doc", reg_ok ) )
12 printf( "#2 not matched!\n");
13 if ( !boost::regex_match( L"/data/txt/a.DOCX", reg_ok ) )
14 printf( "#3 not matched!\n");
15 if ( !boost::regex_match( L"/data/txt/a.docx", reg_ok ) )
16 printf( "#4 not matched!\n");
17
18 if ( !boost::regex_match( L"/data/txt/a.DOC", reg_bad ) )
19 printf( "#5 not matched!\n");
20 if ( !boost::regex_match( L"/data/txt/a.doc", reg_bad ) )
21 printf( "#6 not matched!\n");
22 if ( !boost::regex_match( L"/data/txt/a.DOCX", reg_bad ) )
23 printf( "#7 not matched!\n");
24 if ( !boost::regex_match( L"/data/txt/a.docx", reg_bad ) )
25 printf( "#8 not matched!\n");
26}
27