pd_alg_sub_test.cpp
Go to the documentation of this file.
1 /** @file pd_alg_nb_sub_a_test.cpp Unit Tests */
2 
3 
4 /* Pushdown plugin for FAU Discrete Event Systems Library (libfaudes)
5 
6  Copyright (C) 2013 Stefan Jacobi, Sven Schneider, Anne-Kathrin Hess
7 
8 */
9 #include "pd_alg_sub_test.h"
10 
11 namespace faudes {
12 
13 
14 /* *****************
15  * TestAnnotatePdStatesRenaming
16  * *****************/
18  std::string name = "AnnotatePdStates Renaming";
19  std::cout << "Testing " << name << " ..." << std::endl;
20 
21  std::string renameString = "old";
22 
24  PushdownGenerator g2 = AnnotatePdStates(renameString,g1);
25 
26  try{
27  StateSet::Iterator its;
28  for(its = g2.StatesBegin(); its != g2.StatesEnd(); its++){
29 
30  const MergeStateAnnotation* msa = dynamic_cast<const MergeStateAnnotation*>(g2.StateAttribute(*its).Merge());
31 
32  if(msa == NULL)
33  throw Exception(name, "MergeStateAnnotation not set.", 1003);
34  if(msa->Annotation().compare(renameString) != 0){
35  std::stringstream errstr;
36  errstr << "Annotation incorrect, was " << msa->Annotation() << ", but " << renameString << " was expected." << std::endl;
37  throw Exception(name, errstr.str(), 1003);
38  }
39  }
40  }
41  catch (Exception e){
42  }
43  std::cout << "Finished " << name << std::endl;
44 }
45 
46 /* *****************
47  * TestAnnotatePdStatesNumberOfStates
48  * *****************/
50  std::string name = "AnnotatePdStates Number of States";
51  std::cout << "Testing " << name << " ..." << std::endl;
52 
53  std::string renameString = "old";
54 
56  PushdownGenerator g2 = AnnotatePdStates(renameString,g1);
57 
58  try{
59  if(g1.Size() != g2.Size()){
60  std::stringstream errstr;
61  errstr << "Incorrect, number of states, was " << g1.Size() << ", but " << g2.Size() << " was expected." << std::endl;
62  throw Exception(name, errstr.str(), 1003);
63  }
64  }
65  catch (Exception e){
66  }
67  std::cout << "Finished " << name << std::endl;
68 }
69 
70 /* *****************
71  * TestRenameStackSymboldRenamingStackSymbols
72  * *****************/
74  std::string name = "RenameStackSymbold Renaming Stack Symbols";
75  std::cout << "Testing " << name << " ..." <<std::endl;
76 
77  std::string renameString = "old";
78 
80  PushdownGenerator g2 = RenameStackSymbold(renameString,g1);
81 
82  try{
83  StackSymbolSet::Iterator it;
84  for(it = g1.StackSymbolsBegin(); it != g1.StackSymbolsEnd(); it++){
85  //lambda does not get renamed so test for not getting renamed instead
86  if(g2.IsStackSymbolLambda(*it)){
87  if(!g2.StackSymbols().Exists(g2.StackSymbolName(*it))){
88  std::stringstream errstr;
89  errstr << "Annotation incorrect, " << g2.StackSymbolName(*it) << " was expected, but not found in the stack symbol list:\n" ;
90  StackSymbolSet::Iterator iterr;
91  for(iterr = g2.StackSymbolsBegin(); iterr != g2.StackSymbolsEnd(); iterr++){
92  errstr << " " << g2.StackSymbolName(*iterr);
93  }
94  errstr << std::endl;
95  throw Exception(name, errstr.str(), 1003);
96  }
97  }
98  //all other symbols must get renamed
99  else{
100  if(!g2.StackSymbols().Exists(renameString + "-" + g2.StackSymbolName(*it))){
101  std::stringstream errstr;
102  errstr << "Annotation incorrect, " << renameString << "-" << g2.StackSymbolName(*it) << " was expected, but not found in the stack symbol list:\n" ;
103  StackSymbolSet::Iterator iterr;
104  for(iterr = g2.StackSymbolsBegin(); iterr != g2.StackSymbolsEnd(); iterr++){
105  errstr << " " << g2.StackSymbolName(*iterr);
106  }
107  errstr << std::endl;
108  throw Exception(name, errstr.str(), 1003);
109  }
110  }
111 
112  }
113  }
114  catch(Exception e){
115  }
116  std::cout << "Finished " << name << std::endl;
117 }
118 
119 /* *****************
120  * TestRenameStackSymboldNumberOfStackSymbols
121  * *****************/
123  std::string name = "RenameStackSymbold Number of Stack Symbols";
124  std::cout << "Testing " << name << " ..." << std::endl;
125 
126  std::string renameString = "old";
127 
129  PushdownGenerator g2 = RenameStackSymbold(renameString,g1);
130 
131  try{
132  if(g1.StackSymbols().Size() != g2.StackSymbols().Size()){
133  std::stringstream errstr;
134  errstr << "Incorrect number of stack symbols, was " << g1.StackSymbols().Size() << ", but " << g2.StackSymbols().Size() << " was expected." << std::endl;
135  throw Exception(name, errstr.str(), 1003);
136  }
137  }
138  catch (Exception e){
139  }
140  std::cout << "Finished " << name << std::endl;
141 }
142 
143 /* *****************
144  * TestRenameStackSymboldRenamingTransitions
145  * *****************/
147 
148  FAUDES_TEST_DUMP("test 77",true)
149 
150  std::string name = "RenameStackSymbold Renaming Transitions";
151  std::cout << "Testing " << name << " ..." << std::endl;
152 
153  std::string renameString = "old";
154 
156  PushdownGenerator g2 = RenameStackSymbold(renameString,g1);
157 
158  TransSet::Iterator tit;
159  std::vector<Idx> oldPush, oldPop, push, pop;
160  std::vector<Idx>::const_iterator pushit, popit;
161  PopPushSet popPush;
162  PopPushSet::const_iterator ppit;
163 
164  try{
165  for(tit = g2.TransRelBegin(); tit != g2.TransRelEnd(); tit++){
166  //examine all pop/push pairs
167  popPush = g2.PopPush(*tit);
168  for(ppit = popPush.begin(); ppit != popPush.end(); ppit++){
169 
170  //test pop stack symbols
171  oldPop = ppit->first;
172  for(popit = oldPop.begin(); popit != oldPop.end(); popit++){
173 
174  //everything but lambda must be renamed
175  if(!g2.IsStackSymbolLambda(*popit)){
176  std::string annotation = g2.StackSymbolName(*popit).substr(0, renameString.size() + 1);
177  if(annotation.compare(renameString + "-") != 0){
178  std::stringstream errstr;
179  errstr << "Annotation incorrect, " << renameString << "- was expected, but symbol was " << g2.StackSymbolName(*popit) << std::endl;
180  throw Exception(name, errstr.str(), 1003);
181  }
182  }
183  }
184 
185  //test push stack symbols
186  oldPush = ppit->second;
187  for(pushit = oldPush.begin(); pushit != oldPush.end(); pushit++){
188 
189  //everything but lambda must be renamed
190  if(!g2.IsStackSymbolLambda(*pushit)){
191  std::string annotation = g2.StackSymbolName(*pushit).substr(0, renameString.size() + 1);
192  if(annotation.compare(renameString + "-") != 0){
193  std::stringstream errstr;
194  errstr << "Annotation incorrect, " << renameString << "- was expected, but symbol was " << g2.StackSymbolName(*pushit) << std::endl;
195  throw Exception(name, errstr.str(), 1003);
196  }
197  }
198  }
199  }
200 
201  }
202  }
203  catch(Exception e){
204  FAUDES_TEST_DUMP("test 77 ERROR ",false)
205  }
206  std::cout << "Finished " << name << std::endl;
207 }
208 
209 /* *****************
210  * TestRemoveLambdaPopNoLambdaPop
211  * *****************/
213  std::string name = "RemoveLambdaPop No Lambda Pop";
214  std::cout << "Testing " << name << " ..." << std::endl;
215 
218 
219  try{
220 
221  //iterate over all transitions
222  TransSet::Iterator tit;
223  PopPushSet::const_iterator ppsit;
224  for(tit = g2.TransRel().Begin(); tit != g2.TransRel().End(); tit++){
225 
226  //get all PopPush pairs, extract pop (first), extract foremost
227  //stack symbol (front), and test for lambda
228  for(ppsit = g2.PopPush(*tit).begin(); ppsit != g2.PopPush(*tit).end(); ppsit++){
229  if(g2.IsStackSymbolLambda(ppsit->first.front())){
230  std::stringstream errstr;
231  errstr << "Lambda popping edges not removed, Lambda pop found in transition" << g2.TransRel().Str(*tit) << std::endl;
232  throw Exception(name, errstr.str(), 1003);
233  }
234  }
235  }
236  }
237  catch(Exception e){
238  }
239  std::cout << "Finished " << name << std::endl;
240 }
241 
242 /* *****************
243  * TestRemoveLambdaPopAllExpectingTransition
244  * *****************/
246  std::string name = "RemoveLambdaPop All Expecting Transition";
247  std::cout << "Testing " << name << " ..." << std::endl;
248 
251 
252  //test g1 for lambda transition
253  TransSet::Iterator tit;
254  PopPushSet::const_iterator ppsit;
255  bool hasLambda;
256  for(tit = g1.TransRel().Begin(); tit != g1.TransRel().End(); tit++){
257 
258  //get all PopPush pairs, extract pop (first), extract foremost
259  //stack symbol (front), and test for lambda
260  for(ppsit = g1.PopPush(*tit).begin(); ppsit != g1.PopPush(*tit).end(); ppsit++){
261  if(g2.IsStackSymbolLambda(ppsit->first.front())){
262  hasLambda = true;
263  //lambda was found, no need to search further
264  break;
265  }
266  }
267  }
268 
269  if(!hasLambda){
270  std::cout << "warning: cannot perform test, because there is no lambda pop in the original generator" << std::endl;
271  return;
272  }
273 
274  //test g2 for transition (s1,ev,s2,u,uw), where u is every stack symbol
275  //except for lambda and bottom
276  try{
277 
278  //iterate over all transitions
279  std::vector<Idx> pop, push;
280  std::vector<Idx>::const_iterator popit, pushit;
281  StackSymbolSet::Iterator ssit;
282  bool transFound, symbolFound;
283  for(tit = g2.TransRel().Begin(); tit != g2.TransRel().End(); tit++){
284  transFound = true;
285 
286  //iterate over all relevant stack symbols and see if there is one PopPush
287  //pair with pop u and push wu
288  for(ssit = g2.StackSymbols().Begin(); ssit != g2.StackSymbols().End(); ssit++){
289 
290  //lambda and stack bottom are not relevant
291  if (*ssit == g2.StackBottom() || g2.IsStackSymbolLambda(*ssit)) continue;
292 
293  //test PopPush pairs and find at least one (u,uw) PopPush pair per symbol
294  symbolFound = false;
295  for(ppsit = g2.PopPush(*tit).begin(); ppsit != g2.PopPush(*tit).end(); ppsit++){
296 
297  pop = ppsit->first;
298  push = ppsit->second;
299  //if front of pop or push are identical, the pair is found
300  if(pop.front() == *ssit && *push.rbegin() == *ssit){
301  symbolFound = true;
302  break;
303  }
304  }
305  //if any one symbol has not been found, this transition is not relevant
306  if(!symbolFound){
307  transFound = false;
308  break;
309  }
310  }
311  //no need to look for another such transition
312  if(transFound) break;
313  }
314 
315  if(!transFound){
316  std::stringstream errstr;
317  errstr << "Original generator has lambda popping edge, but result generator has no edge that accepts all stack symbols" << std::endl;
318  throw Exception(name, errstr.str(), 1003);
319  }
320  }
321  catch(Exception e){
322  }
323  std::cout << "Finished " << name << std::endl;
324 }
325 
326 /* ****************
327  * TestRemoveMultPopNumberOfTransitions
328  * *****************/
330 
331  std::string name = "RemoveMultPop Number of States and Transitions";
332  TestStart(name);
333 
335 
336  //expected resulst for this particular test generator
337  Idx expectedNumberTransitions = 11;
338  Idx expectedNumberStates = 10;
339 
341 
342  try{
343 
344  //test for number of states
345  if(g2.Size() != expectedNumberStates){
346  std::stringstream errstr;
347  errstr << "Number of states was " << g2.Size() << ", but " << expectedNumberStates << " was expected." << std::endl;
348  throw Exception(name, errstr.str(), 1003);
349  }
350 
351  //test for number of transitions
352  if(g2.TransRelSize() != expectedNumberTransitions){
353  std::stringstream errstr;
354  errstr << "Number of transitions incorrect" << g2.TransRelSize() << ", but " << expectedNumberTransitions << " was expected." << std::endl;
355  throw Exception(name, errstr.str(), 1003);
356  }
357  }
358  catch (Exception e){
359  }
360 
361  TestEnd(name);
362 }
363 
364 /* ****************
365  * TestSPDAReadPopPushOnly
366  * *****************/
368  //TODO dont know what to expect
369 // std::string name = "SPDA Number States Transitions";
370 // TestStart(name);
371 //
372 // PushdownGenerator g1 = TestGenerator6();
373 //
374 // PushdownGenerator g2 = SPDA(g1);
375 // try{
376 // //number of states must be 7
377 // if(g2.Size() != 7){
378 // std::stringstream errstr;
379 // errstr << "Number of states was expected to be 7, but was " << g2.Size() << "." << std::endl;
380 // throw Exception(name, errstr.str(), 1003);
381 // }
382 //
383 // TransSet::Iterator transit;
384 // PopPushSet::const_iterator ppit;
385 // //number of transitions must be 10
386 // int transCount = 0;
387 // for(transit = g2.TransRelBegin(); transit != g2.TransRelEnd(); transit++){
388 // transCount += g2.PopPush(*transit).size();
389 // }
390 //
391 // if(transCount != 10){
392 // std::stringstream errstr;
393 // errstr << "Number of transitions was expected to be 10, but was " << transCount << "." << std::endl;
394 // throw Exception(name, errstr.str(), 1003);
395 // }
396 // }
397 // catch (Exception e){
398 // }
399 // TestEnd(name);
400 }
401 
402 /* ****************
403  * TestSPDAReadPopPushOnly
404  * *****************/
406  std::string name = "SPDA Read Pop Push Only";
407  TestStart(name);
408 
410  PushdownGenerator g2 = SPDA(g1);
411 
412  try{
413  TransSet::Iterator transit;
414  PopPushSet::const_iterator ppit;
415  std::vector<Idx> pop, push;
416  std::vector<Idx>::const_iterator ssit;
417  for(transit = g2.TransRelBegin(); transit != g2.TransRelEnd(); transit++){
418  for(ppit = g2.PopPushBegin(*transit); ppit != g2.PopPushEnd(*transit); ppit++){
419 
420  //read pop and push for convenience
421  pop = ppit->first;
422  push = ppit->second;
423 
424  //check for read only transition
425  if(!g2.IsEventLambda(transit->Ev) &&
426  pop == push){
427  continue;
428  }
429  //check for pop only transition
430  else if(g2.IsEventLambda(transit->Ev) &&
431  !g2.IsStackSymbolLambda(pop.front()) &&
432  pop.size() == 1 &&
433  g2.IsStackSymbolLambda(push.front())){
434  continue;
435  }
436  //check for push only transition
437  else if(g2.IsEventLambda(transit->Ev) &&
438  push.size() == 2 &&
439  pop.size() == 1 &&
440  pop.front() == push.back()){
441  continue;
442  }
443  //error
444  else{
445  std::stringstream errstr;
446  errstr << "Transition (" << transit->X1 << ", " << g2.EventName(transit->Ev) << ", " << transit->X2 << ") with pop [";
447  for(ssit = pop.begin(); ssit != pop.end(); ssit++){
448  errstr << " " << g2.StackSymbolName(*ssit);
449  }
450  errstr << "] and push [";
451  for(ssit = push.begin(); ssit != push.end(); ssit++){
452  errstr << " " << g2.StackSymbolName(*ssit);
453  }
454  errstr << "] was neither read nor pop nor push." << std::endl;
455  throw Exception(name, errstr.str(), 1003);
456  }
457  }
458  }
459  }
460  catch (Exception e){
461  }
462  TestEnd(name);
463 }
464 
465 /* ****************
466  * TestNdaActivePassive
467  * *****************/
469  std::string name = "Nda Active Passive";
470  TestStart(name);
471 
473  PushdownGenerator g2 = Nda(g1);
474 
475  try{
476  //the number of transitions must have doubled
477  if(2*g1.States().Size() != g2.States().Size()){
478  std::stringstream errstr;
479  errstr << "Number of states incorrect, was" << g2.States().Size() << ", but " << 2*g1.States().Size() << " was expected." << std::endl;
480  throw Exception(name, errstr.str(), 1003);
481  }
482 
483  StateSet::Iterator stateit;
484  int active = 0;
485  int passive = 0;
486  //there must be an equal amount of active and passive states
487  for(stateit = g2.StatesBegin(); stateit != g2.StatesEnd(); stateit++){
488 
489  const MergeStateAnnotation* msa = dynamic_cast<const MergeStateAnnotation*>(g2.StateAttribute(*stateit).Merge());
490 
491  if(msa == NULL)
492  throw Exception(name, "MergeStateAnnotation not set.", 1003);
493 
494  if(msa->Annotation().compare("active") == 0){
495  active++;
496  }
497  else if(msa->Annotation().compare("passive") == 0){
498  passive++;
499  }
500  else{
501  std::stringstream errstr;
502  errstr << "Annotation incorrect, was " << msa->Annotation() << ", but either active or passive was expected." << std::endl;
503  throw Exception(name, errstr.str(), 1003);
504  }
505  }
506  if(active != passive){
507  std::stringstream errstr;
508  errstr << "There were " << active << " active states and " << passive << " passive states, but equal numbers were expected." << std::endl;
509  throw Exception(name, errstr.str(), 1003);
510  }
511  }
512  catch (Exception e){
513  }
514 
515  TestEnd(name);
516 }
517 
518 /* ****************
519  * TestNdaTransitions
520  * *****************/
522  std::string name = "Nda Transitions";
523  TestStart(name);
524 
526  PushdownGenerator g2 = Nda(g1);
527 
528  //put together expected transitions for later comparison
529  std::set<std::pair<Idx,Idx> > expectedTransitions;
530  expectedTransitions.insert(std::make_pair(1,3));
531  expectedTransitions.insert(std::make_pair(1,5));
532  expectedTransitions.insert(std::make_pair(2,3));
533  expectedTransitions.insert(std::make_pair(2,6));
534  expectedTransitions.insert(std::make_pair(3,8));
535  expectedTransitions.insert(std::make_pair(4,8));
536  expectedTransitions.insert(std::make_pair(5,3));
537  expectedTransitions.insert(std::make_pair(6,4));
538  expectedTransitions.insert(std::make_pair(7,6));
539  expectedTransitions.insert(std::make_pair(8,6));
540 
541  try{
542  TransSet::Iterator transit;
543  for(transit = g2.TransRelBegin(); transit != g2.TransRelEnd(); transit++){
544 
545  if(expectedTransitions.erase(std::make_pair(transit->X1, transit->X2)) == 0){
546  std::stringstream errstr;
547  errstr << "Transition from state " << transit->X1 << " to state " << transit->X2 << " found, but was not expected." << std::endl;
548  throw Exception(name, errstr.str(), 1003);
549  }
550  }
551 
552  if(expectedTransitions.size() != 0){
553  std::stringstream errstr;
554  errstr << "Not all expected transitions were found." << std::endl;
555  throw Exception(name, errstr.str(), 1003);
556  }
557  }
558  catch (Exception e){
559  }
560 
561  TestEnd(name);
562 }
563 
564 /* *****************
565  * TestAnnotatePdStates
566  * *****************/
569  //TestAnnotatePdStatesNumberOfStates();
570 }
571 
572 /* *****************
573  * TestRenameStackSymbold
574  * *****************/
579 }
580 
581 /* *****************
582  * TestRemoveLambdaPop
583  * *****************/
587 }
588 
589 /* ****************
590  * TestSPDA
591  * *****************/
592 void TestSPDA(){
595 }
596 
597 /* *****************
598  * TestRemoveMultPop
599  * *****************/
602 }
603 
604 /* *****************
605  * TestNda
606  * *****************/
607 void TestNda(){
608 
611 }
612 
613 /* *****************
614  * TestFilterMixedGrammarSymbols
615  * *****************/
617 
618  std::string name = "Filter Mixed Grammar Symbols";
619  TestStart(name);
620 
621  Grammar gr1 = TestGrammar1();
622 
623  GrammarSymbolVector word;
624  std::set<Terminal>::const_iterator tit;
625  std::vector<TerminalPtr> tpv;
626  std::vector<TerminalPtr>::iterator tpvit;
627  std::set<Nonterminal> rSet;
628 
629  //build word to filter
630  //contains one nonterminal and all terminals
631  Terminal* t;
632  Nonterminal* nt = new Nonterminal(*gr1.Nonterminals().begin());
633  GrammarSymbolPtr ntPtr(nt);
634  word.push_back(ntPtr);
635 
636  for(tit = gr1.Terminals().begin(); tit != gr1.Terminals().end(); tit++){
637  //create new terminal
638  t = new Terminal(*tit);
639  TerminalPtr tPtr(t);
640  //push terminal into word
641  word.push_back(tPtr);
642  }
643 
644  rSet = Filter(gr1.Nonterminals(),word);
645 
646  try{
647  //resulting set size has to be one
648  if(rSet.size() != 1){
649  std::stringstream errstr;
650  errstr << "size of result set is " << rSet.size() << ", but 1 was expected" << std::endl;
651  throw Exception(name, errstr.str(), 1003);
652  }
653  //resulting set has to contain *gr1.Nonterminals().begin()
654 
655  if(*rSet.begin() != *gr1.Nonterminals().begin()){
656  std::stringstream errstr;
657  errstr << "result set did not contain the expected nonterminal " << gr1.Nonterminals().begin()->Str() << std::endl;
658  throw Exception(name, errstr.str(), 1003);
659  }
660  }
661  catch(Exception e){
662  std::cout << (*rSet.begin()).Str() << std::endl;
663  std::cout << (*gr1.Nonterminals().begin()).Str() << std::endl;
664  }
665 
666  TestEnd(name);
667 }
668 
669 /* *****************
670  * TestFilterNothing
671  * *****************/
673  std::string name = "Filter Nothing";
674  TestStart(name);
675 
676  std::set<Nonterminal> nt;
678 
679  std::set<Nonterminal> rSet = Filter(nt,gs);
680 
681  try{
682  //resulting set size has to be zero
683  if(rSet.size() != 0){
684  std::stringstream errstr;
685  errstr << "size of result set is " << rSet.size() << ", but 0 was expected" << std::endl;
686  throw Exception(name, errstr.str(), 1003);
687  }
688  }
689  catch(Exception e){
690  }
691 
692  TestEnd(name);
693 }
694 
695 /* *****************
696  * TestRnpp1FindSymbolsEmptySet
697  * *****************/
699  std::string name = "Rnpp1 Find Symbols Empty Set";
700  TestStart(name);
701 
702  Grammar gr = TestGrammar1();
703 
704  //eliminable nonterminal which should be found by Rnpp1
705  std::vector<Idx> v;
706  v.push_back(3);
707  Nonterminal nt(5,v,1);
708  //the grammar should contain this nonterminal!
709  if(gr.Nonterminals().find(nt) == gr.Nonterminals().end()){
710  std::cout << "Warning, test parameters seem to be wrong. The test grammar did not contain Nonterminal (5,[3],1)." << std::endl;
711  return;
712  }
713 
714  //empty set of already eliminated nonterminals
715  std::set<Nonterminal> ntSet;
716 
717  std::set<Nonterminal> rSet = Rnpp1(gr,ntSet);
718 
719  try{
720  //resulting set size has to be one
721  if(rSet.size() != 1){
722  std::stringstream errstr;
723  errstr << "size of result set is " << rSet.size() << ", but 1 was expected" << std::endl;
724  throw Exception(name, errstr.str(), 1003);
725  }
726  //resulting set size has to contain nonterminal (3,2)
727  if(*rSet.begin() != nt){
728  std::stringstream errstr;
729  errstr << "result set did not contain the expected nonterminal " << nt.Str() << std::endl;
730  throw Exception(name, errstr.str(), 1003);
731  }
732  }
733  catch(Exception e){
734  }
735 
736  TestEnd(name);
737 }
738 
739 /* *****************
740  * TestRnpp1FindSymbolsNonemptySet
741  * *****************/
743  std::string name = "Rnpp1 Find Symbols Empty Set";
744  TestStart(name);
745 
746  Grammar gr = TestGrammar1();
747 
748  //eliminable nonterminal which should be found
749  std::vector<Idx> v;
750  v.push_back(2);
751  Nonterminal nt(1,v,2);
752  //the grammar should contain this nonterminal!
753  if(gr.Nonterminals().find(nt) == gr.Nonterminals().end()){
754  std::cout << "Warning, test parameters seem to be wrong. The test grammar did not contain Nonterminal (1,[2],2)." << std::endl;
755  std::cout << gr.Str() << std::endl;
756  return;
757  }
758 
759  //empty set of already eliminated nonterminals
760  std::set<Nonterminal> ntSet;
761 
762  std::set<Nonterminal> rSet = Rnpp1(gr,Rnpp1(gr,ntSet));
763 
764  try{
765  //resulting set size has to be one
766  if(rSet.size() != 2){
767  std::stringstream errstr;
768  errstr << "size of result set is " << rSet.size() << ", but 2 was expected" << std::endl;
769  throw Exception(name, errstr.str(), 1003);
770  }
771  //resulting set size has to contain nonterminal (1,2,2)
772  if(*rSet.begin() != nt){
773  std::stringstream errstr;
774  errstr << "result set did not contain the expected nonterminal " << nt.Str() << std::endl;
775  throw Exception(name, errstr.str(), 1003);
776  }
777  }
778  catch(Exception e){
779  }
780 
781  TestEnd(name);
782 }
783 
784 /* *****************
785  * TestRnpplFindSymbolsEmptySet
786  * *****************/
788  std::string name = "Rnppl Find Symbols Empty Set";
789  TestStart(name);
790 
791  Grammar gr = TestGrammar1();
792 
793  //all nonterminals should be eliminable except (2,3,3)
794  std::set<Nonterminal> findThis = gr.Nonterminals();
795  std::vector<Idx> v;
796  v.push_back(3);
797  findThis.erase(Nonterminal(2,v,3));
798 
799  //empty set of already eliminated nonterminals
800  std::set<Nonterminal> ntSet;
801 
802  std::set<Nonterminal> rSet = Rnppl(gr,ntSet);
803 
804  try{
805  //resulting set size has to be the size of findThis
806  if(rSet.size() != findThis.size()){
807  std::stringstream errstr;
808  errstr << "size of result set is " << rSet.size() << ", but " << findThis.size() << " was expected" << std::endl;
809  throw Exception(name, errstr.str(), 1003);
810  }
811  //resulting set size has to contain all nonterminals in findThis
812  std::set<Nonterminal>::const_iterator ntit, findit;
813  for(ntit = findThis.begin(); ntit != findThis.end(); ntit++){
814  //look for every nonterminal
815  findit = rSet.find(*ntit);
816  //throw error if it was not found
817  if(findit == findThis.end()){
818  std::stringstream errstr;
819  errstr << "result set did not contain the expected nonterminal " << ntit->Str() << std::endl;
820  throw Exception(name, errstr.str(), 1003);
821  }
822  }
823  }
824  catch(Exception e){
825  }
826 
827  TestEnd(name);
828 }
829 
830 /* *****************
831  * TestRnpplFindSymbolsNonemptySet
832  * *****************/
834  std::string name = "Rnppl Find Symbols Nonempty Set";
835  TestStart(name);
836 
837  Grammar gr = TestGrammar1();
838 
839  //all nonterminals should be eliminable except (2,3,3)
840  std::set<Nonterminal> findThis = gr.Nonterminals();
841  std::vector<Idx> v;
842  v.push_back(3);
843  findThis.erase(Nonterminal(2,v,3));
844 
845  //set of already eliminated nonterminals, add any eliminable nonterminals
846  std::set<Nonterminal> ntSet;
847  v.clear(); v.push_back(2);
848  ntSet.insert(Nonterminal(1,v,2));
849  v.clear(); v.push_back(3);
850  ntSet.insert(Nonterminal(4,v));
851 
852  std::set<Nonterminal> rSet = Rnppl(gr,ntSet);
853 
854  try{
855  //resulting set size has to be the size of findThis
856  if(rSet.size() != findThis.size()){
857  std::stringstream errstr;
858  errstr << "size of result set is " << rSet.size() << ", but " << findThis.size() << " was expected" << std::endl;
859  throw Exception(name, errstr.str(), 1003);
860  }
861  //resulting set size has to contain all nonterminals in findThis
862  std::set<Nonterminal>::const_iterator ntit, findit;
863  for(ntit = findThis.begin(); ntit != findThis.end(); ntit++){
864  //look for every nonterminal
865  findit = rSet.find(*ntit);
866  //throw error if it was not found
867  if(findit == findThis.end()){
868  std::stringstream errstr;
869  errstr << "result set did not contain the expected nonterminal " << ntit->Str() << std::endl;
870  throw Exception(name, errstr.str(), 1003);
871  }
872  }
873  }
874  catch(Exception e){
875  }
876 
877  TestEnd(name);
878 }
879 
880 /* *****************
881  * TestRnpplFindSymbolsCompleteSet
882  * *****************/
884  std::string name = "Rnppl Find Symbols Complete Set";
885  TestStart(name);
886 
887  Grammar gr = TestGrammar1();
888 
889  //all nonterminals should be eliminable except (2,3,3)
890  std::set<Nonterminal> findThis = gr.Nonterminals();
891  std::vector<Idx> v;
892  v.push_back(3);
893  findThis.erase(Nonterminal(2,v,3));
894 
895  //set of already eliminated nonterminals, add any eliminable nonterminals
896  std::set<Nonterminal> ntSet = findThis;
897 
898  std::set<Nonterminal> rSet = Rnppl(gr,ntSet);
899 
900  try{
901  //resulting set size has to be the size of findThis
902  if(rSet.size() != findThis.size()){
903  std::stringstream errstr;
904  errstr << "size of result set is " << rSet.size() << ", but " << findThis.size() << " was expected" << std::endl;
905  throw Exception(name, errstr.str(), 1003);
906  }
907  //resulting set size has to contain all nonterminals in findThis
908  std::set<Nonterminal>::const_iterator ntit, findit;
909  for(ntit = findThis.begin(); ntit != findThis.end(); ntit++){
910  //look for every nonterminal
911  findit = rSet.find(*ntit);
912  //throw error if it was not found
913  if(findit == findThis.end()){
914  std::stringstream errstr;
915  errstr << "result set did not contain the expected nonterminal " << ntit->Str() << std::endl;
916  throw Exception(name, errstr.str(), 1003);
917  }
918  }
919  }
920  catch(Exception e){
921  }
922 
923  TestEnd(name);
924 }
925 
926 /* *****************
927  * TestRnppGrammar1
928  * *****************/
930  std::string name = "Rnpp Grammar 1";
931  TestStart(name);
932 
933  Grammar gr = TestGrammar1();
934 
935  //all nonterminals should be eliminable except (2,3,3)
936  std::set<Nonterminal> finalNtSet = gr.Nonterminals();
937  std::vector<Idx> v;
938  v.push_back(3);
939  finalNtSet.erase(Nonterminal(2,v,3));
940  //only one grammar production contains (2,3,3) and must be removed
941  std::set<GrammarProduction> finalGpSet = gr.GrammarProductions();
943  Nonterminal* nt = new Nonterminal(2,v,3);
944  GrammarSymbolPtr ntPtr(nt);
945  vg.push_back(ntPtr);
946  v.clear(); v.push_back(2);
947  finalGpSet.erase(GrammarProduction(Nonterminal(1,v,2), vg));
948 
949  Grammar rGr = Rnpp(gr);
950 
951  try{
952  //resulting size of nonterminals has to be the size of finalNtSet
953  if(rGr.Nonterminals().size() != finalNtSet.size()){
954  std::stringstream errstr;
955  errstr << "size of nonterminal set is " << rGr.Nonterminals().size() << ", but " << finalNtSet.size() << " was expected" << std::endl;
956  throw Exception(name, errstr.str(), 1003);
957  }
958  //resulting size of grammar productions has to be the size of finalGpSet
959  if(rGr.GrammarProductions().size() != finalGpSet.size()){
960  std::stringstream errstr;
961  errstr << "size of grammar production set is " << rGr.GrammarProductions().size() << ", but " << finalGpSet.size() << " was expected" << std::endl;
962  throw Exception(name, errstr.str(), 1003);
963  }
964 
965  //resulting set size has to contain all nonterminals in finalNtSet
966  std::set<Nonterminal>::const_iterator ntit, findntit;
967  for(ntit = finalNtSet.begin(); ntit != finalNtSet.end(); ntit++){
968  //look for every nonterminal
969  findntit = rGr.Nonterminals().find(*ntit);
970  //throw error if it was not found
971  if(findntit == finalNtSet.end()){
972  std::stringstream errstr;
973  errstr << "nonterminal set did not contain the expected nonterminal " << ntit->Str() << std::endl;
974  throw Exception(name, errstr.str(), 1003);
975  }
976  }
977 
978  //resulting set size has to contain all grammar productions in finalGpSet
979  std::set<GrammarProduction>::const_iterator gpit, findgpit;
980  for(gpit = finalGpSet.begin(); gpit != finalGpSet.end(); gpit++){
981  //look for every nonterminal
982  findgpit = rGr.GrammarProductions().find(*gpit);
983  //throw error if it was not found
984  if(findgpit == finalGpSet.end()){
985  std::stringstream errstr;
986  errstr << "grammar productions set did not contain the expected grammar production " << gpit->Str() << std::endl;
987  throw Exception(name, errstr.str(), 1003);
988  }
989  }
990  }
991  catch(Exception e){
992  }
993 
994  TestEnd(name);
995 }
996 
997 /* *****************
998  * TestRnppGrammar2
999  * *****************/
1001  std::string name = "Rnpp Grammar 2";
1002  TestStart(name);
1003 
1004  Grammar gr = TestGrammar2();
1005 
1006  //all nonterminals should be eliminable except (2,3,3) and (3,2)
1007  std::vector<Idx> v2;
1008  v2.push_back(2);
1009  std::vector<Idx> v3;
1010  v3.push_back(3);
1011  std::set<Nonterminal> finalNtSet = gr.Nonterminals();
1012  finalNtSet.erase(Nonterminal(2,v3,3));
1013  finalNtSet.erase(Nonterminal(3,v2));
1014  //only one grammar production contains (2,3,3) and must be removed, no grammar
1015  //production contains (3,2)
1016  std::set<GrammarProduction> finalGpSet = gr.GrammarProductions();
1018  Nonterminal* nt = new Nonterminal(2,v3,3);
1019  GrammarSymbolPtr ntPtr(nt);
1020  vg.push_back(ntPtr);
1021  finalGpSet.erase(GrammarProduction(Nonterminal(1,v2,2), vg));
1022 
1023  Grammar rGr = Rnpp(gr);
1024 
1025  try{
1026  //resulting size of nonterminals has to be the size of finalNtSet
1027  if(rGr.Nonterminals().size() != finalNtSet.size()){
1028  std::stringstream errstr;
1029  errstr << "size of nonterminal set is " << rGr.Nonterminals().size() << ", but " << finalNtSet.size() << " was expected" << std::endl;
1030  throw Exception(name, errstr.str(), 1003);
1031  }
1032  //resulting size of grammar productions has to be the size of finalGpSet
1033  if(rGr.GrammarProductions().size() != finalGpSet.size()){
1034  std::stringstream errstr;
1035  errstr << "size of grammar production set is " << rGr.GrammarProductions().size() << ", but " << finalGpSet.size() << " was expected" << std::endl;
1036  throw Exception(name, errstr.str(), 1003);
1037  }
1038 
1039  //resulting set size has to contain all nonterminals in finalNtSet
1040  std::set<Nonterminal>::const_iterator ntit, findntit;
1041  for(ntit = finalNtSet.begin(); ntit != finalNtSet.end(); ntit++){
1042  //look for every nonterminal
1043  findntit = rGr.Nonterminals().find(*ntit);
1044  //throw error if it was not found
1045  if(findntit == finalNtSet.end()){
1046  std::stringstream errstr;
1047  errstr << "nonterminal set did not contain the expected nonterminal " << ntit->Str() << std::endl;
1048  throw Exception(name, errstr.str(), 1003);
1049  }
1050  }
1051 
1052  //resulting set size has to contain all grammar productions in finalGpSet
1053  std::set<GrammarProduction>::const_iterator gpit, findgpit;
1054  for(gpit = finalGpSet.begin(); gpit != finalGpSet.end(); gpit++){
1055  //look for every nonterminal
1056  findgpit = rGr.GrammarProductions().find(*gpit);
1057  //throw error if it was not found
1058  if(findgpit == finalGpSet.end()){
1059  std::stringstream errstr;
1060  errstr << "grammar productions set did not contain the expected grammar production " << gpit->Str() << std::endl;
1061  throw Exception(name, errstr.str(), 1003);
1062  }
1063  }
1064  }
1065  catch(Exception e){
1066  }
1067 
1068  TestEnd(name);
1069 }
1070 
1071 /* *****************
1072  * TestRnppEmptyGrammar
1073  * *****************/
1075  std::string name = "Rnpp Empty Grammar";
1076  TestStart(name);
1077 
1078  Grammar gr;
1079 
1080  Grammar rGr = Rnpp(gr);
1081 
1082  try{
1083  //resulting size of nonterminals has to be zero
1084  if(rGr.Nonterminals().size() != 0){
1085  std::stringstream errstr;
1086  errstr << "size of nonterminal set is " << rGr.Nonterminals().size() << ", but 0 was expected" << std::endl;
1087  throw Exception(name, errstr.str(), 1003);
1088  }
1089  //resulting size of grammar productions has to be zero
1090  if(rGr.GrammarProductions().size() != 0){
1091  std::stringstream errstr;
1092  errstr << "size of grammar production set is " << rGr.GrammarProductions().size() << ", but 0 was expected" << std::endl;
1093  throw Exception(name, errstr.str(), 1003);
1094  }
1095  }
1096  catch(Exception e){
1097  }
1098 
1099  TestEnd(name);
1100 }
1101 
1102 /* *****************
1103  * TestSp2LrTerminals
1104  * *****************/
1106  std::string name = "Sp2Lr Terminals";
1107  TestStart(name);
1108 
1110 
1111  Grammar gr = Sp2Lr(g);
1112 
1113  try{
1114  //size of terminals must be the same as size of events
1115  if(g.Alphabet().Size() != gr.Terminals().size()){
1116  std::stringstream errstr;
1117  errstr << "size of terminal set is " << gr.Terminals().size() << ", but "<< g.Alphabet().Size() << " was expected" << std::endl;
1118  throw Exception(name, errstr.str(), 1003);
1119  }
1120 
1121  EventSet::Iterator eventit;
1122  //terminals must be all events
1123  for(eventit = g.AlphabetBegin(); eventit != g.AlphabetEnd(); eventit++){
1124  if(gr.Terminals().find(*eventit) == gr.Terminals().end()){
1125  std::stringstream errstr;
1126  errstr << "terminal " << g.EventName(*eventit) << " was not found in terminal set" << std::endl;
1127  throw Exception(name, errstr.str(), 1003);
1128  }
1129  }
1130  }
1131  catch(Exception e){
1132  }
1133 
1134  TestEnd(name);
1135 }
1136 
1137 /* *****************
1138  * TestSp2LrNonterminals
1139  * *****************/
1141  std::string name = "Sp2Lr Nonterminals";
1142  TestStart(name);
1143 
1145 
1146  Grammar gr = Sp2Lr(g,0,true);
1147 
1148  try{
1149  //number of expected nonterminals
1150  uint expectedNumberNonterminals = 8;
1151 
1152  //if the size of nonterminals matches the expected size, none can be missing
1153  if(expectedNumberNonterminals != gr.Nonterminals().size()){
1154  std::stringstream errstr;
1155  errstr << "size of nonterminal set is " << gr.Nonterminals().size() << ", but "<< expectedNumberNonterminals << " was expected" << std::endl;
1156  throw Exception(name, errstr.str(), 1003);
1157  }
1158 
1159  //test for the correct starting nonterminal
1160  if(gr.StartSymbol().StartState() != 1 || gr.StartSymbol().EndState() != 0 || gr.StartSymbol().OnStack().front() != g.StackSymbolIndex("square")){
1161  std::stringstream errstr;
1162  errstr << "start symbol was " << gr.StartSymbol().Str() << ", but (2, [square]) was expected" << std::endl;
1163  throw Exception(name, errstr.str(), 1003);
1164  }
1165  }
1166  catch(Exception e){
1167  }
1168 
1169  TestEnd(name);
1170 }
1171 
1172 /* *****************
1173  * TestSp2Lr2Productions
1174  * *****************/
1176  std::string name = "Sp2Lr2 Productions ";
1177  TestStart(name);
1178 
1180 
1181  Grammar gr = Sp2Lr(g);
1182 
1183  std::vector<Idx> dot, lambda, square;
1184  dot.push_back(g.StackSymbolIndex("dot"));
1185  square.push_back(g.StackSymbolIndex("square"));
1186  lambda.push_back(g.StackSymbolIndex("lambda"));
1187 
1188  Nonterminal* nt1dot = new Nonterminal(1,dot);
1189  GrammarSymbolPtr nt1dotPtr(nt1dot);
1190  Nonterminal* nt1square = new Nonterminal(1,square);
1191  GrammarSymbolPtr nt1squarePtr(nt1square);
1192  Nonterminal* nt2dot = new Nonterminal(2,dot);
1193  GrammarSymbolPtr nt2dotPtr(nt2dot);
1194  Nonterminal* nt2square = new Nonterminal(2,square);
1195  GrammarSymbolPtr nt2squarePtr(nt2square);
1196  Nonterminal* nt1dot1 = new Nonterminal(1,dot,1);
1197  GrammarSymbolPtr nt1dot1Ptr(nt1dot1);
1198  Nonterminal* nt1dot2 = new Nonterminal(1,dot,2);
1199  GrammarSymbolPtr nt1dot2Ptr(nt1dot2);
1200  Nonterminal* nt1square1 = new Nonterminal(1,square,1);
1201  GrammarSymbolPtr nt1square1Ptr(nt1square1);
1202  Nonterminal* nt1square2 = new Nonterminal(1,square,2);
1203  GrammarSymbolPtr nt1square2Ptr(nt1square2);
1204  Nonterminal* nt2dot1 = new Nonterminal(2,dot,1);
1205  GrammarSymbolPtr nt2dot1Ptr(nt2dot1);
1206  Nonterminal* nt2dot2 = new Nonterminal(2,dot,2);
1207  GrammarSymbolPtr nt2dot2Ptr(nt2dot2);
1208  Nonterminal* nt2square1 = new Nonterminal(2,square,1);
1209  GrammarSymbolPtr nt2square1Ptr(nt2square1);
1210  Nonterminal* nt2square2 = new Nonterminal(2,square,2);
1211  GrammarSymbolPtr nt2square2Ptr(nt2square2);
1212  Terminal* ta = new Terminal(g.EventIndex("a"));
1213  GrammarSymbolPtr taPtr(ta);
1214  Terminal* tlambda = new Terminal(g.EventIndex(FAUDES_PD_LAMBDA));
1215  GrammarSymbolPtr tlambdaPtr(tlambda);
1216 
1217 
1219  //expected read set
1220  std::set<GrammarProduction> read;
1221  v.clear();
1222  v.push_back(taPtr);
1223  v.push_back(nt1dot2Ptr);
1224  read.insert(GrammarProduction(*nt2dot2,v));
1225 
1226  //expected pop set
1227  std::set<GrammarProduction> pop;
1228  v.clear();
1229  v.push_back(tlambdaPtr);
1230  pop.insert(GrammarProduction(*nt1dot2,v));
1231 
1232  //expected push set
1233  std::set<GrammarProduction> push;
1234  v.clear();
1235  v.push_back(nt2dot2Ptr);
1236  v.push_back(nt2squarePtr);
1237  push.insert(GrammarProduction(*nt1square,v));
1238  v.clear();
1239  v.push_back(nt2dotPtr);
1240  push.insert(GrammarProduction(*nt1square,v));
1241 
1242  //expected final state set
1243  std::set<GrammarProduction> final;
1244  v.clear();
1245  v.push_back(tlambdaPtr);
1246  final.insert(GrammarProduction(*nt2dot,v));
1247  v.clear();
1248  v.push_back(tlambdaPtr);
1249  final.insert(GrammarProduction(*nt2square,v));
1250 
1251  try{
1252 
1253  std::set<GrammarProduction> gp = gr.GrammarProductions();
1254  std::set<GrammarProduction>::const_iterator gpit;
1255  //test for read
1256  for(gpit = read.begin(); gpit != read.end(); gpit++){
1257  if(gp.erase(*gpit) == 0){
1258  std::stringstream errstr;
1259  errstr << "grammar production " << gpit->Str() << " , which is generated by a read transition, was expected but not found in the grammar" << std::endl;
1260  throw Exception(name, errstr.str(), 1003);
1261  }
1262  }
1263 
1264  //test for pop
1265  for(gpit = pop.begin(); gpit != pop.end(); gpit++){
1266  if(gp.erase(*gpit) == 0){
1267  std::stringstream errstr;
1268  errstr << "grammar production " << gpit->Str() << " , which is generated by a pop transition, was expected but not found in the grammar" << std::endl;
1269  throw Exception(name, errstr.str(), 1003);
1270  }
1271  }
1272 
1273  //test for push
1274  for(gpit = push.begin(); gpit != push.end(); gpit++){
1275  if(gp.erase(*gpit) == 0){
1276  std::stringstream errstr;
1277  errstr << "grammar production " << gpit->Str() << " , which is generated by a push transition, was expected but not found in the grammar" << std::endl;
1278  throw Exception(name, errstr.str(), 1003);
1279  }
1280  }
1281 
1282  //test for final states
1283  for(gpit = final.begin(); gpit != final.end(); gpit++){
1284  if(gp.erase(*gpit) == 0){
1285  std::stringstream errstr;
1286  errstr << "grammar production " << gpit->Str() << " , which is generated by a final transition, was expected but not found in the grammar" << std::endl;
1287  throw Exception(name, errstr.str(), 1003);
1288  }
1289  }
1290 
1291  //all productions must have been looked at by now
1292  if(gp.size() != 0){
1293  std::stringstream errstr;
1294  errstr << "the grammar contained" << gp.size() << " more productions than expected" << std::endl;
1295  throw Exception(name, errstr.str(), 1003);
1296  }
1297  }
1298  catch(Exception e){
1299  }
1300 
1301  TestEnd(name);
1302 }
1303 
1304 /* *****************
1305  * TestRupProductions
1306  * *****************/
1308  std::string name = "Test Rup Productions";
1309  TestStart(name);
1310 
1311  Grammar gr = TestGrammar3();
1312  Grammar rGr = Rup(gr);
1313 
1314  try{
1315 
1316  //only one production must have been removed
1317  if(gr.GrammarProductions().size() - 1 != rGr.GrammarProductions().size()){
1318  std::stringstream errstr;
1319  errstr << "size of grammar productions was " << rGr.GrammarProductions().size() << ", but " << gr.GrammarProductions().size() - 1 << " was expected" << std::endl;
1320  throw Exception(name, errstr.str(), 1003);
1321  }
1322 
1323  //only the grammar production (2, [dot], 2) -> a(1, [dot]) must have been removed
1324  std::vector<Idx> v;
1325  v.push_back(PushdownGenerator::GlobalStackSymbolTablep()->Index("dot"));
1326  Nonterminal* nt1 = new Nonterminal(2,v,2);
1327  GrammarSymbolPtr nt1Ptr(nt1);
1328  Nonterminal* nt2 = new Nonterminal(1,v);
1329  GrammarSymbolPtr nt2Ptr(nt2);
1331  GrammarSymbolPtr tPtr(t);
1333  gs.push_back(tPtr);
1334  gs.push_back(nt2Ptr);
1335  GrammarProduction gp(*nt1,gs);
1336 
1337  if(gr.GrammarProductions().find(gp) != gr.GrammarProductions().end()){
1338  std::stringstream errstr;
1339  errstr << "grammar production (2, [dot], 2) -> a(1, [dot]) was present, but was expected to be deleted" << std::endl;
1340  throw Exception(name, errstr.str(), 1003);
1341  }
1342  }
1343  catch(Exception e){
1344  }
1345 
1346  TestEnd(name);
1347 }
1348 
1349 /* *****************
1350  * TestRupNonterminals
1351  * *****************/
1353  std::string name = "Test Rup Nonterminals";
1354  TestStart(name);
1355 
1356  Grammar gr = TestGrammar3();
1357  Grammar rGr = Rup(gr);
1358 
1359  try{
1360 
1361  //only one nonterminal must have been removed
1362  if(gr.Nonterminals().size() - 1 != rGr.Nonterminals().size()){
1363  std::stringstream errstr;
1364  errstr << "size of nonterminals was " << rGr.Nonterminals().size() << ", but " << gr.Nonterminals().size() - 1 << " was expected" << std::endl;
1365  throw Exception(name, errstr.str(), 1003);
1366  }
1367 
1368  //only the nonterminal (2, [dot], 2) must have been removed
1369  std::vector<Idx> v;
1370  v.push_back(PushdownGenerator::GlobalStackSymbolTablep()->Index("dot"));
1371  Nonterminal nt(2,v,2);
1372  if(gr.Nonterminals().find(nt) != gr.Nonterminals().end()){
1373  std::stringstream errstr;
1374  errstr << "nonterminal (2, [dot], 2) was present, but was expected to be deleted" << std::endl;
1375  throw Exception(name, errstr.str(), 1003);
1376  }
1377  }
1378  catch(Exception e){
1379  }
1380 
1381 
1382  TestEnd(name);
1383 }
1384 
1385 /* *****************
1386  * TestFilter
1387  * *****************/
1388 void TestFilter(){
1391 }
1392 
1393 /* *****************
1394  * TestRnpp1
1395  * *****************/
1396 void TestRnpp1(){
1399 }
1400 
1401 /* *****************
1402  * TestRnpp1
1403  * *****************/
1404 void TestRnppl(){
1408 }
1409 
1410 /* *****************
1411  * TestRnpp
1412  * *****************/
1413 void TestRnpp(){
1414  TestRnppGrammar1();
1415  TestRnppGrammar2();
1417 }
1418 
1419 /* *****************
1420  * Sp2Lr
1421  * *****************/
1422 void TestSp2Lr(){
1423 
1427 }
1428 
1429 
1430 /* *****************
1431  * Rup
1432  * *****************/
1433 void TestRup(){
1434 
1437 }
1438 } // namespace faudes
1439 

libFAUDES 2.26g --- 2015.08.17 --- c++ api documentaion by doxygen