Skip to content
Snippets Groups Projects
Commit 59fde843 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

use default data types in regexp tests

parent a2f9a18a
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ void RegExpOptimizeTest::testOptimize() {
regexp::UnboundedRegExp < > res = regexp::simplify::RegExpOptimize::optimize(regexp);
 
std::string inputRes = "a";
regexp::UnboundedRegExp < > regexpRes( static_cast<const regexp::UnboundedRegExp < > &>( alib::StringDataFactory::fromString<regexp::RegExp>(inputRes).getData() ) );
regexp::UnboundedRegExp < > regexpRes( static_cast<const regexp::UnboundedRegExp < DefaultSymbolType > &>( alib::StringDataFactory::fromString<regexp::RegExp>(inputRes).getData() ) );
 
std::cout << res << std::endl;
std::cout << regexpRes << std::endl;
......
......@@ -35,7 +35,7 @@ void RegExpConcatenateTest::testRegExpConcatenate() {
std::string input1 = "(#E a b)";
regexp::RegExp re1 = alib::StringDataFactory::fromString<regexp::RegExp>(input1);
 
regexp::RegExp re2(regexp::FormalRegExp < > (regexp::FormalRegExpStructure < alphabet::Symbol > (regexp::FormalRegExpConcatenation < alphabet::Symbol > (regexp::FormalRegExpEmpty < alphabet::Symbol > {}, regexp::FormalRegExpEpsilon < alphabet::Symbol > {}))));
regexp::RegExp re2(regexp::FormalRegExp < > (regexp::FormalRegExpStructure < DefaultSymbolType > (regexp::FormalRegExpConcatenation < DefaultSymbolType > (regexp::FormalRegExpEmpty < DefaultSymbolType > {}, regexp::FormalRegExpEpsilon < DefaultSymbolType > {}))));
 
regexp::RegExp re = regexp::RegExpConcatenate::concatenate(re1, re2);
 
......@@ -45,7 +45,7 @@ void RegExpConcatenateTest::testRegExpConcatenate() {
CPPUNIT_ASSERT(re == rer);
}
{
regexp::RegExp re1(regexp::FormalRegExp < > (regexp::FormalRegExpStructure < alphabet::Symbol > (regexp::FormalRegExpConcatenation < alphabet::Symbol > (regexp::FormalRegExpEmpty < alphabet::Symbol > {}, regexp::FormalRegExpEpsilon < alphabet::Symbol > {}))));
regexp::RegExp re1(regexp::FormalRegExp < > (regexp::FormalRegExpStructure < DefaultSymbolType > (regexp::FormalRegExpConcatenation < DefaultSymbolType > (regexp::FormalRegExpEmpty < DefaultSymbolType > {}, regexp::FormalRegExpEpsilon < DefaultSymbolType > {}))));
 
std::string input2 = "(#E a b)";
regexp::RegExp re2 = alib::StringDataFactory::fromString<regexp::RegExp>(input2);
......
......@@ -4,6 +4,7 @@
#include <string/String.h>
 
#include <factory/StringDataFactory.hpp>
#include "factory/XmlDataFactory.hpp"
 
#define CPPUNIT_IMPLY(x, y) CPPUNIT_ASSERT(!(x) || (y))
 
......@@ -32,9 +33,15 @@ void RegExpDerivationTest::testRegExpDerivation() {
}
 
void RegExpDerivationTest::ExecSingleTest(std::string regexp_str, std::string string_str, std::string result) {
regexp::RegExp regexp = alib::StringDataFactory::fromString<regexp::RegExp>(regexp_str);
regexp::RegExp regexp0 = alib::StringDataFactory::fromString<regexp::RegExp>(regexp_str);
std::deque<sax::Token> tokens = alib::XmlDataFactory::toTokens(regexp0);
regexp::RegExp regexp = alib::XmlDataFactory::fromTokens<regexp::RegExp>(std::move(tokens));
 
string::LinearString < > string = static_cast<const string::LinearString < >&>(alib::StringDataFactory::fromString<string::String>("\"" + string_str + "\"").getData());
string::String string0 = alib::StringDataFactory::fromString<string::String>("\"" + string_str + "\"");
std::deque<sax::Token> tokens2 = alib::XmlDataFactory::toTokens(string0);
string::String string1 = alib::XmlDataFactory::fromTokens<string::String>(std::move(tokens2));
string::LinearString < > string = static_cast<const string::LinearString < >&>(string1.getData());
 
std::cout << alib::StringDataFactory::toString<regexp::RegExp>(regexp::RegExpDerivation::derivation(regexp, string)) << " == " << std::endl << result << std::endl << std::endl;
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment