39 Generator deter_nondet(
"data/deterministic_nondet.gen");
42 deter_det.
Write(
"tmp_deterministic_det.gen");
43 deter_nondet.
Write(
"tmp_deterministic_nondet.gen");
46 std::cout <<
"################################\n";
47 std::cout <<
"# deterministic generator \n";
49 std::cout <<
"################################\n";
62 Generator minimal_nonmin(
"data/minimal_nonmin.gen");
64 StateMin(minimal_nonmin, minimal_min);
65 minimal_nonmin.
Write(
"tmp_minimal_nonmin.gen");
66 minimal_min.
Write(
"tmp_minimal_min.gen");
69 std::cout <<
"################################\n";
70 std::cout <<
"# minimal generator \n";
72 std::cout <<
"################################\n";
84 Generator project_g(
"data/project_g.gen");
91 Project(project_g, alph_proj, project_prog);
92 project_g.
Write(
"tmp_project_g.gen");
97 StateMin(project_prog,project_prog_min);
98 project_prog_min.
Write(
"tmp_project_prog.gen");
101 std::cout <<
"################################\n";
102 std::cout <<
"# projected generator \n";
103 project_prog_min.
DWrite();
104 std::cout <<
"################################\n";
116 Generator parallel_g1(
"data/parallel_g1.gen");
117 Generator parallel_g2(
"data/parallel_g2.gen");
121 Parallel(parallel_g1, parallel_g2, parallel_g1g2);
124 parallel_g1.
Write(
"tmp_parallel_g1.gen");
125 parallel_g2.
Write(
"tmp_parallel_g2.gen");
126 parallel_g1g2.
Write(
"tmp_parallel_g1g2.gen");
129 Generator parallel_m1(
"data/wparallel_g1.gen");
130 Generator parallel_m2(
"data/wparallel_g2.gen");
134 Parallel(parallel_m1, parallel_m2, parallel_m1m2);
137 parallel_m1.
Write(
"tmp_parallel_m1.gen");
138 parallel_m2.
Write(
"tmp_parallel_m2.gen");
139 parallel_m1m2.
Write(
"tmp_parallel_m1m2.gen");
142 Generator wparallel_g1(
"data/wparallel_g1.gen");
143 Generator wparallel_g2(
"data/wparallel_g2.gen");
150 wparallel_g1.
Write(
"tmp_wparallel_g1.gen");
151 wparallel_g2.
Write(
"tmp_wparallel_g2.gen");
152 wparallel_g1g2.
Write(
"tmp_wparallel_g1g2.gen");
165 Generator boolean_g1(
"data/boolean_g1.gen");
166 Generator boolean_g2(
"data/boolean_g2.gen");
167 Generator lequal_g1(
"data/lequal_g1.gen");
168 Generator lequal_g2(
"data/lequal_g2.gen");
181 Generator boolean_complement_g1=boolean_g1;
184 Generator boolean_complement2_g1=boolean_complement_g1;
188 boolean_g1.
Write(
"tmp_boolean_g1.gen");
189 boolean_g2.
Write(
"tmp_boolean_g2.gen");
190 boolean_union.
Write(
"tmp_union_g1g2.gen");
191 boolean_intersection.
Write(
"tmp_intersection_g1g2.gen");
192 boolean_complement_g1.
Write(
"tmp_complement_g1.gen");
193 boolean_complement2_g1.
Write(
"tmp_complement2_g1.gen");
196 std::cout <<
"################################\n";
197 std::cout <<
"# boolean language operations\n";
199 boolean_intersection.
DWrite();
200 boolean_complement_g1.
DWrite();
201 std::cout <<
"################################\n";
204 std::cout <<
"################################\n";
205 std::cout <<
"# boolean language operations\n";
207 std::cout <<
"Lm(g1) <= Lm(g1) v Lm(g2): OK\n";
209 std::cout <<
"Lm(g1) <= Lm(g1) v Lm(g2): ERR\n";
211 std::cout <<
"Lm(g1) ^ ~Lm(g1) = empty: OK\n";
213 std::cout <<
"(Lm(g1) v Lm(g2)) ^ ~(Lm(g1) v Lm(g2)) != empty: ERR\n";
215 std::cout <<
"Lm(g1) = ~~Lm(g1) : OK\n";
217 std::cout <<
"Lm(g1) != ~~Lm(g1) : ERR\n";
218 std::cout <<
"################################\n";
221 std::cout <<
"################################\n";
222 std::cout <<
"# boolean language operations for empty Lm(g1)\n";
224 std::cout <<
"Lm(g1) <= Lm(g2): OK\n";
226 std::cout <<
"Lm(g1) <= Lm(g2): ERR\n";
228 std::cout <<
"Lm(g2) <= Lm(g1): ERR\n";
230 std::cout <<
"~(Lm(g2) <= Lm(g1)): OK\n";
233 std::cout <<
"Lm(g1) == Lm(g2): ERR\n";
235 std::cout <<
"Lm(g1) != Lm(g2): OK\n";
250 Generator difference_g1(
"data/difference_g1.gen");
251 difference_g1.
Write(
"tmp_difference_g1.gen");
253 Generator difference_g2(
"data/difference_g2.gen");
254 difference_g2.
Write(
"tmp_difference_g2.gen");
260 difference_g1minusg2.
Write(
"tmp_difference_g1minusg2.gen");
263 std::cout <<
"################################\n";
264 std::cout <<
"# language difference Lm(g1)-Lm(g2) \n";
265 difference_g1minusg2.
DWrite();
266 std::cout <<
"################################\n";
278 Generator automaton_g(
"data/automaton_g.gen");
279 automaton_g.
Write(
"tmp_automaton_g.gen");
283 automaton_g.
Write(
"tmp_automaton_gRes.gen");
286 std::cout <<
"################################\n";
287 std::cout <<
"# automaton from generator \n";
289 std::cout <<
"################################\n";
299 Generator concat_g1(
"data/concat_g1.gen");
300 Generator concat_g2(
"data/concat_g2.gen");
301 Generator concat_g3(
"data/concat_g3.gen");
302 Generator concat_g4(
"data/concat_g4.gen");
303 Generator concat_g5(
"data/concat_g5.gen");
304 Generator concat_g6(
"data/concat_g6.gen");
305 concat_g1.
Write(
"tmp_concat_g1.gen");
306 concat_g2.
Write(
"tmp_concat_g2.gen");
307 concat_g3.
Write(
"tmp_concat_g3.gen");
308 concat_g4.
Write(
"tmp_concat_g4.gen");
309 concat_g5.
Write(
"tmp_concat_g5.gen");
310 concat_g6.
Write(
"tmp_concat_g6.gen");
314 std::cout <<
"################################\n";
315 std::cout <<
"# language concatenation\n";
319 concat.
Write(
"tmp_concat_g1g3.gen");
322 concat.
Write(
"tmp_concat_g1g4.gen");
325 concat.
Write(
"tmp_concat_g2g3.gen");
328 concat.
Write(
"tmp_concat_g2g4.gen");
331 concat.
Write(
"tmp_concat_g5g6.gen");
333 std::cout <<
"################################\n";
345 languages_alphabet.
Insert(
"a");
346 languages_alphabet.
Insert(
"b");
353 languages_g.
Write(
"tmp_languagesFull_result.gen");
356 std::cout <<
"################################\n";
357 std::cout <<
"# full language \n";
362 languages_g.
Write(
"tmp_languagesAlphabet_result.gen");
363 std::cout <<
"# alphabet language \n";
368 languages_g.
Write(
"tmp_languagesEmptyString_result.gen");
369 std::cout <<
"# empty string language \n";
374 languages_g.
Write(
"tmp_languagesEmpty_result.gen");
375 std::cout <<
"# empty language \n";
377 std::cout <<
"################################\n";
387 Generator kleene_g1(
"data/kleene_g1.gen");
388 kleene_g1.
Write(
"tmp_kleene_g1.gen");
393 kleene_g1.
Write(
"tmp_kleene_g1Res.gen");
396 std::cout <<
"################################\n";
397 std::cout <<
"# Kleene closure \n";
399 std::cout <<
"################################\n";
406 Generator kleene_g2(
"data/kleene_g2.gen");
407 kleene_g2.
Write(
"tmp_kleene_g2.gen");
412 kleene_g2.
Write(
"tmp_kleene_g2Res.gen");
415 std::cout <<
"################################\n";
416 std::cout <<
"# Kleene closure \n";
418 std::cout <<
"################################\n";
429 Generator prefixclosure_g(
"data/prefixclosure_g.gen");
430 prefixclosure_g.
Write(
"tmp_prefixclosure_g.gen");
437 prefixclosure_g.
Write(
"tmp_prefixclosure_gRes.gen");
443 std::cout <<
"################################\n";
444 std::cout <<
"# prefix closure \n";
446 std::cout <<
"# argument was prefix closed (test case error!)\n";
448 std::cout <<
"# argument was not prefix closed (expected)\n";
449 if(isprefixclosed_gRes)
450 std::cout <<
"# result is prefix closed (expected)\n";
452 std::cout <<
"# result is not prefix closed (test case error!)\n";
454 std::cout <<
"################################\n";
466 Generator omegaclosure_g(
"data/omegaclosure_g.gen");
467 omegaclosure_g.
Write(
"tmp_omegaclosure_g.gen");
474 omegaclosure_g.
Write(
"tmp_omegaclosure_gRes.gen");
480 std::cout <<
"################################\n";
481 std::cout <<
"# omega closure \n";
483 std::cout <<
"# argument was omega closed (test case error!)\n";
485 std::cout <<
"# argument was not omega closed (expected)\n";
486 if(isomegaclosed_gRes)
487 std::cout <<
"# result is omega closed (expected)\n";
489 std::cout <<
"# result is not omega closed (test case error!)\n";
491 std::cout <<
"################################\n";
503 Generator selfloop_g(
"data/selfloop_g.gen");
504 selfloop_g.
Write(
"tmp_selfloop_g.gen");
508 selfloop_alphabet.
Insert(
"e");
509 selfloop_alphabet.
Insert(
"f");
515 SelfLoop(selfloop_gRes,selfloop_alphabet);
516 selfloop_gRes.
Write(
"tmp_selfloop_gRes.gen");
519 std::cout <<
"################################\n";
520 std::cout <<
"# selfloop, each state \n";
524 selfloop_gRes=selfloop_g;
526 selfloop_gRes.
Write(
"tmp_selfloopMarked_gRes.gen");
527 std::cout <<
"# selfloop, marked states \n";
531 selfloop_gRes=selfloop_g;
533 selfloop_gRes.
Write(
"tmp_selfloopInit_gRes.gen");
534 std::cout <<
"# selfloop, init state(s) \n";
536 std::cout <<
"################################\n";
545 std::cout <<
"################################\n";
546 std::cout <<
"# non-blocking test \n";
549 std::cout <<
"# conflict equiv. abstract test 1 \n";
553 nonblocking_g.
Read(
"data/noblo_gae2.gen");
555 nonblocking_g.
Write();
565 nonblocking_gv.
PushBack(
"data/noblo_g2.gen");
566 nonblocking_gv.
PushBack(
"data/noblo_g3.gen");
567 nonblocking_gv.
PushBack(
"data/noblo_g4.gen");
568 nonblocking_gv.
PushBack(
"data/noblo_g5.gen");
570 std::cout <<
"# non-blocking exec test 1\n";
571 bool nonblocking_ok1;
574 std::cout <<
"# non-blocking test: passed (expected)\n";
576 std::cout <<
"# non-blocking test: failed (test case error!)\n";
581 nonblocking_gv.
Clear();
582 nonblocking_gv.
PushBack(
"data/noblo_g5.gen");
583 nonblocking_gv.
PushBack(
"data/noblo_g6.gen");
584 nonblocking_gv.
PushBack(
"data/noblo_g7.gen");
585 nonblocking_gv.
PushBack(
"data/noblo_g8.gen");
586 nonblocking_gv.
PushBack(
"data/noblo_g9.gen");
588 std::cout <<
"# non-blocking exec test 2\n";
589 bool nonblocking_ok2;
592 std::cout <<
"# non-blocking test: passed (expected)\n";
594 std::cout <<
"# non-blocking test: failed (test case error!)\n";
599 nonblocking_gv.
Clear();
600 nonblocking_gv.
PushBack(
"data/noblo_g3.gen");
601 nonblocking_gv.
PushBack(
"data/noblo_g4.gen");
602 nonblocking_gv.
PushBack(
"data/noblo_g5.gen");
603 nonblocking_gv.
PushBack(
"data/noblo_g6.gen");
604 nonblocking_gv.
PushBack(
"data/noblo_g7.gen");
606 std::cout <<
"# non-blocking exec test 3\n";
607 bool nonblocking_ok3;
610 std::cout <<
"# non-blocking test: passed (test case error!)\n";
612 std::cout <<
"# non-blocking test: failed (expected)\n";
617 nonblocking_gv.
Clear();
618 nonblocking_gv.
PushBack(
"data/noblo_g1.gen");
619 nonblocking_gv.
PushBack(
"data/noblo_g3.gen");
620 nonblocking_gv.
PushBack(
"data/noblo_g5.gen");
621 nonblocking_gv.
PushBack(
"data/noblo_g7.gen");
623 std::cout <<
"# non-blocking exec test 4\n";
624 bool nonblocking_ok4;
627 std::cout <<
"# non-blocking test: passed (test case error!)\n";
629 std::cout <<
"# non-blocking test: failed (expected)\n";
634 nonblocking_gv.
Clear();
635 nonblocking_gv.
PushBack(
"data/noblo_g1.gen");
636 nonblocking_gv.
PushBack(
"data/noblo_g2.gen");
637 nonblocking_gv.
PushBack(
"data/noblo_g3.gen");
638 nonblocking_gv.
PushBack(
"data/noblo_g6.gen");
639 nonblocking_gv.
PushBack(
"data/noblo_g7.gen");
641 std::cout <<
"# non-blocking exec test 5\n";
642 bool nonblocking_ok5;
645 std::cout <<
"# non-blocking test: passed (expected)\n";
647 std::cout <<
"# non-blocking test: failed (test case error!)\n";
650 nonblocking_gv.
Clear();
651 nonblocking_gv.
PushBack(
"data/noblo_g1.gen");
652 nonblocking_gv.
PushBack(
"data/noblo_g2.gen");
653 nonblocking_gv.
PushBack(
"data/noblo_g3.gen");
654 nonblocking_gv.
PushBack(
"data/noblo_g4.gen");
655 nonblocking_gv.
PushBack(
"data/noblo_g5.gen");
656 nonblocking_gv.
PushBack(
"data/noblo_g6.gen");
657 nonblocking_gv.
PushBack(
"data/noblo_g7.gen");
659 std::cout <<
"# non-blocking exec test 6\n";
660 bool nonblocking_ok6;
663 std::cout <<
"# non-blocking test: passed (expected)\n";
665 std::cout <<
"# non-blocking test: failed (test case error!)\n";
668 nonblocking_gv.
Clear();
669 nonblocking_gv.
PushBack(
"data/noblo_g1.gen");
670 nonblocking_gv.
PushBack(
"data/noblo_g2.gen");
671 nonblocking_gv.
PushBack(
"data/noblo_g3.gen");
672 nonblocking_gv.
PushBack(
"data/noblo_g4.gen");
673 nonblocking_gv.
PushBack(
"data/noblo_g5.gen");
674 nonblocking_gv.
PushBack(
"data/noblo_g6.gen");
676 std::cout <<
"# non-blocking exec test 7\n";
677 bool nonblocking_ok7;
680 std::cout <<
"# non-blocking test: passed (expected)\n";
682 std::cout <<
"# non-blocking test: failed (test case error!)\n";
685 nonblocking_gv.
Clear();
686 nonblocking_gv.
PushBack(
"data/noblo_g2.gen");
687 nonblocking_gv.
PushBack(
"data/noblo_g4.gen");
688 nonblocking_gv.
PushBack(
"data/noblo_g6.gen");
689 nonblocking_gv.
PushBack(
"data/noblo_g8.gen");
691 std::cout <<
"# non-blocking exec test 8\n";
692 bool nonblocking_ok8;
695 std::cout <<
"# non-blocking test: passed (expected)\n";
697 std::cout <<
"# non-blocking test: failed (test case error!)\n";
701 nonblocking_gv.
Clear();
702 nonblocking_gv.
PushBack(
"data/noblo_yt1.gen");
703 nonblocking_gv.
PushBack(
"data/noblo_yt2.gen");
706 std::cout <<
"# non-blocking exec test 9a\n";
708 Parallel(nonblocking_gv.
At(0),nonblocking_gv.
At(1),parallel12);
709 bool nonblocking_ok9;
712 std::cout <<
"# non-blocking test: passed (test case error!)\n";
714 std::cout <<
"# non-blocking test: failed (expected)\n";
719 std::cout <<
"# non-blocking exec test 9b\n";
722 std::cout <<
"# non-blocking test: passed (test case error!)\n";
724 std::cout <<
"# non-blocking test: failed (expected)\n";
732 std::cout <<
"done.\n";
#define FAUDES_TEST_DIFF()
Test protocol diff macro.
#define FAUDES_TEST_DUMP(mes, dat)
Test protocol record macro ("mangle" filename for platform independance)
Set of indices with symbolic names.
bool Insert(const Idx &rIndex)
Add an element by index.
virtual const T & At(const Position &pos) const
Access element.
void DWrite(const Type *pContext=0) const
Write configuration data to console, debugging format.
void Read(const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
Read configuration data from file with label specified.
void Write(const Type *pContext=0) const
Write configuration data to console.
virtual void PushBack(const Type &rElem)
Append specified entry.
virtual void Clear(void)
Clear all vector.
Base class of all FAUDES generators.
const StateSet & InitStates(void) const
Const ref to initial states.
StateSet BlockingStates(void) const
Compute set of blocking states.
bool StateNamesEnabled(void) const
Whether libFAUEDS functions are requested to generate state names.
Idx Size(void) const
Get Size of TBaseSet.
void ConflictEquivalentAbstraction(vGenerator &rGen, EventSet &rSilentEvents)
Conflict equivalent abstraction.
void StateMin(const Generator &rGen, Generator &rResGen)
State set minimization.
void FullLanguage(const EventSet &rAlphabet, Generator &rResGen)
Full Language, L(G)=Lm(G)=Sigma*.
void LanguageUnion(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Language union, deterministic version.
void SelfLoop(Generator &rGen, const EventSet &rAlphabet)
Self-loop all states.
bool LanguageDisjoint(const Generator &rGen1, const Generator &rGen2)
Test whether two languages are disjoint.
bool LanguageInclusion(const Generator &rGen1, const Generator &rGen2)
Test language inclusion, Lm1<=Lm2.
void KleeneClosure(Generator &rGen)
Kleene Closure.
void PrefixClosure(Generator &rGen)
Prefix Closure.
void Deterministic(const Generator &rGen, Generator &rResGen)
Make generator deterministic.
void Automaton(Generator &rGen, const EventSet &rAlphabet)
Convert generator to automaton wrt specified alphabet.
bool IsOmegaClosed(const Generator &rGen)
Test for topologically closed omega language.
void AlphabetLanguage(const EventSet &rAlphabet, Generator &rResGen)
Alphabet Language, L(G)=Lm(G)=Sigma.
void OmegaParallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Parallel composition with relaxed acceptance condition.
void OmegaClosure(Generator &rGen)
Topological closure.
void LanguageConcatenate(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Language concatenation, deterministic version.
bool LanguageEquality(const Generator &rGen1, const Generator &rGen2)
Language equality, Lm1==Lm2.
void LanguageDifference(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Language difference (set-theoretic difference).
void LanguageIntersection(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Language intersection.
bool IsPrefixClosed(const Generator &rGen)
Test for prefix closed marked language.
void Project(const Generator &rGen, const EventSet &rProjectAlphabet, Generator &rResGen)
Deterministic projection.
void EmptyLanguage(const EventSet &rAlphabet, Generator &rResGen)
Empty language Lm(G)={}.
void Parallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Parallel composition.
void LanguageComplement(Generator &rGen, const EventSet &rAlphabet)
Language complement wrt specified alphabet.
void EmptyStringLanguage(const EventSet &rAlphabet, Generator &rResGen)
Empty string language, L(G)=Lm(G)={epsilon}.
void KleeneClosureNonDet(Generator &rGen)
Kleene Closure, nondeterministic version.
void SelfLoopMarkedStates(Generator &rGen, const EventSet &rAlphabet)
Self-loop all marked states.
Includes all libFAUDES headers, incl plugings
libFAUDES resides within the namespace faudes.
bool IsNonblocking(const GeneratorVector &rGvec)