Skip to content
Snippets Groups Projects
RegExpOptimizeTest.cpp 1.07 KiB
Newer Older
  • Learn to ignore specific revisions
  • Jan Trávníček's avatar
    Jan Trávníček committed
    #include <list>
    #include "RegExpOptimizeTest.h"
    
    #include "regexp/unbounded/UnboundedRegExp.h"
    #include "regexp/RegExpFromStringParser.h"
    
    #include "regexp/RegExpOptimize.h"
    
    #define CPPUNIT_IMPLY(x, y) CPPUNIT_ASSERT(!(x) || (y))
    #define CPPUNIT_EXCLUSIVE_OR(x, y) CPPUNIT_ASSERT((!(x) && (y)) || ((x) && !(y)))
    
    CPPUNIT_TEST_SUITE_REGISTRATION( RegExpOptimizeTest );
    
    void RegExpOptimizeTest::setUp() {
    }
    
    void RegExpOptimizeTest::tearDown() {
    }
    
    void RegExpOptimizeTest::testOptimize() {
    	{
    		std::string input = "(a+a)b + (#0 b + (#0 a + (#0 b + a)))";
    		std::stringstream inputs(input);
    
    		regexp::RegExpFromStringParser parser(inputs);
    		regexp::UnboundedRegExp regexp( static_cast<const regexp::UnboundedRegExp &>( parser.parseValue().getData() ) );
    
    		regexp::RegExpOptimize opt;
    		regexp::UnboundedRegExp res = opt.optimize(regexp);
    	}
    	{
    		std::string input = "a+a* (b+a)* c";
    		std::stringstream inputs(input);
    
    		regexp::RegExpFromStringParser parser(inputs);
    		regexp::UnboundedRegExp regexp( static_cast<const regexp::UnboundedRegExp &>( parser.parseValue().getData() ) );
    
    	}
    
    }