24 std::string& rReportStr)
26 FD_DF(
"IsHioEnvironmentForm("<< rHioEnvironment.
Name() <<
",...)");
35 rErrEvSet.
Name(
"rErrEvSet");
38 rErrTrSet.
Name(
"rErrTrSet");
41 rErrStSet.
Name(
"rErrStSet");
50 bool finalResult =
true;
52 bool localResult =
true;
65 EventSet::Iterator evit;
66 StateSet::Iterator sit;
70 rReportStr.append(
"#########################################################\n");
71 rReportStr.append(
"########## IsHioEnvironmentForm("+rHioEnvironment.
Name()+
",...) - test results:\n");
76 rReportStr.append(
"##### fail: generator is not deterministic!\n");
77 if(initStates.
Size()>1) {
78 rErrStSet = initStates;
79 rReportStr.append(
"##### (amongst others, there is more than one initial state)\n");
85 rReportStr.append(
"#####\n");
91 rReportStr.append(
"########## Condition (i):\n");
95 rReportStr.append(
"##### fail: empty YE alphabet.\n");
100 rReportStr.append(
"##### fail: empty UE alphabet.\n");
105 rReportStr.append(
"##### fail: empty YL alphabet.\n");
110 rReportStr.append(
"##### fail: empty UL alphabet.\n");
123 if(!rErrEvSet.
Empty()){
124 rReportStr.append(
"##### fail: found events with missing or ambiguous attribute:\n");
125 rReportStr.append(rErrEvSet.
ToString()+
"\n");
126 rReportStr.append(
"##### Condition (i) failed.\n");
127 rReportStr.append(
"########## Termination due to crucial failure. ##########\n");
128 rReportStr.append(
"#########################################################\n");
131 if(localResult) rReportStr.append(
"##### Condition (i) passed.\n");
132 else rReportStr.append(
"##### Condition (i) failed.\n");
133 rReportStr.append(
"#####\n");
139 rReportStr.append(
"########## Condition (ii):\n");
143 for(sit = accessibleStates.
Begin(); sit != accessibleStates.
End(); ++sit) {
149 bool goodState =
true;
153 if(activeEv.
Empty()) {
160 evit = activeEv.
Begin();
161 isUl = rHioEnvironment.
IsUl(*evit);
162 isYlUe = rHioEnvironment.
IsYl(*evit);
163 isUe = rHioEnvironment.
IsUe(*evit);
164 isYe = rHioEnvironment.
IsYe(*evit);
166 for(; evit != activeEv.
End(); evit++) {
167 if( (isUl && !rHioEnvironment.
IsUl(*evit)) ||
168 ((isYlUe||isUe) && (!rHioEnvironment.
IsYl(*evit) && (!rHioEnvironment.
IsUe(*evit)))) ||
169 (isYe && !rHioEnvironment.
IsYe(*evit)) ){
178 if(isUe && rHioEnvironment.
IsYl(*evit)) {
186 if(!goodState)
continue;
191 rHioEnvironment.
SetQUl(*sit);
199 rHioEnvironment.
SetQUe(*sit);
203 rHioEnvironment.
SetQYe(*sit);
208 if(localResult) rReportStr.append(
"##### Condition (ii) passed.\n");
211 rReportStr.append(
"##### fail: found states with undecidable attribute:\n");
212 rReportStr.append(locErrStSet.
ToString()+
"\n");
214 rReportStr.append(
"##### Condition (ii) failed.\n");
215 rReportStr.append(
"########## Termination due to crulial failure. ##########\n");
216 rReportStr.append(
"###################### No sulcess. ######################\n");
217 rReportStr.append(
"#########################################################\n");
220 rReportStr.append(
"#####\n");
226 rReportStr.append(
"########## Condition (iii):\n");
229 if(!(initStates <= rQYe)) {
230 rReportStr.append(
"##### fail: some init state(s) is (are) not a QYe-state:\n");
231 locErrStSet=initStates-rQYe;
232 rReportStr.append(locErrStSet.
ToString()+
"\n");
238 if(localResult) rReportStr.append(
"##### Condition (iii) passed.\n");
239 else rReportStr.append(
"##### Condition (iii) failed.\n");
240 rReportStr.append(
"#####\n");
247 rReportStr.append(
"########## Condition (iv):\n");
250 for(sit = rQYe.
Begin(); sit != rQYe.
End(); ++sit) {
253 if ( !( rQYlUe.
Exists(tit->X2) || rQUe.
Exists(tit->X2) ) ) {
263 if(localResult) rReportStr.append(
"##### Condition (iv) passed.\n");
265 rReportStr.append(
"##### fail: found YE-transitions leading to wrong states:\n");
266 rReportStr.append(locErrTrSet.
ToString()+
"\n");
268 rReportStr.append(
"##### Condition (iv) failed.\n");
270 rReportStr.append(
"#####\n");
276 rReportStr.append(
"########## Condition (v):\n");
279 for(sit = rQUe.
Begin(); sit != rQUe.
End(); ++sit) {
281 if(!rQYe.
Exists(tit->X2)) {
290 if(localResult) rReportStr.append(
"##### Condition (v) passed.\n");
292 rReportStr.append(
"##### fail: found UE-transitions leading to wrong states:\n");
293 rReportStr.append(locErrTrSet.
ToString()+
"\n");
295 rReportStr.append(
"##### Condition (v) failed.\n");
297 rReportStr.append(
"#####\n");
303 rReportStr.append(
"########## Condition (vi):\n");
307 for(sit = rQYlUe.
Begin(); sit != rQYlUe.
End(); ++sit) {
310 if( (rHioEnvironment.
IsUe(tit->Ev) && !rQYe.
Exists(tit->X2)) ||
311 (rHioEnvironment.
IsYl(tit->Ev) && !rQUl.
Exists(tit->X2)) ){
320 if(localResult) rReportStr.append(
"##### Condition (vi) passed.\n");
322 rReportStr.append(
"##### fail: found YL- or UE-transitions leading to wrong states:\n");
323 rReportStr.append(locErrTrSet.
ToString()+
"\n");
325 rReportStr.append(
"##### Condition (vi) failed.\n");
327 rReportStr.append(
"#####\n");
333 rReportStr.append(
"########## Condition (vii):\n");
336 for(sit = rQUl.
Begin(); sit != rQUl.
End(); ++sit) {
338 if(!rQUe.
Exists(tit->X2)) {
347 if(localResult) rReportStr.append(
"##### Condition (vii) passed.\n");
349 rReportStr.append(
"##### fail: found UL-transitions leading to wrong states, see rErrTrSet:\n");
350 rReportStr.append(locErrTrSet.
ToString()+
"\n");
352 rReportStr.append(
"##### Condition (vii) failed.\n");
354 rReportStr.append(
"#####\n");
360 rReportStr.append(
"########## Condition (viii):\n");
363 for(sit = rQUl.
Begin(); sit != rQUl.
End(); ++sit) {
373 if(localResult) rReportStr.append(
"##### Condition (viii) passed.\n");
375 rReportStr.append(
"##### fail: found QUl-states with inactive UL-events:\n");
376 rReportStr.append(locErrStSet.
ToString()+
"\n");
378 rReportStr.append(
"##### Condition (viii) failed.\n");
380 rReportStr.append(
"#####\n");
386 rReportStr.append(
"########## Condition (ix):\n");
389 for(sit = rQYe.
Begin(); sit != rQYe.
End(); ++sit) {
399 if(localResult) rReportStr.append(
"##### Condition (ix) passed.\n");
401 rReportStr.append(
"##### fail: found QYe-states with inactive YE-events:\n");
402 rReportStr.append(locErrStSet.
ToString()+
"\n");
404 rReportStr.append(
"##### Condition (ix) failed.\n");
406 rReportStr.append(
"#####\n");
412 rReportStr.append(
"########## Condition (x):\n");
415 if(!(accessibleStates<=rHioEnvironment.
MarkedStates())) {
420 if(localResult) rReportStr.append(
"##### Condition (x) passed.\n");
422 rReportStr.append(
"##### fail: not all accessible states are marked, see rErrStSet:\n");
423 locErrStSet= accessibleStates - rHioEnvironment.
MarkedStates();
425 rReportStr.append(locErrStSet.
ToString()+
"\n");
427 rReportStr.append(
"##### Condition (x) failed.\n");
429 rReportStr.append(
"#####\n");
435 rReportStr.append(
"########## Condition (xi):\n");
438 if(!deadEnds.
Empty()) {
442 rReportStr.append(
"##### fail: found dead ends:\n");
443 rReportStr.append(deadEnds.
ToString()+
"\n");
445 rReportStr.append(
"##### Condition (xi) failed.\n");
447 rReportStr.append(
"##### Condition (xi) passed.\n");
452 rReportStr.append(
"########## Condition (xii):\n");
457 rReportStr.append(
"##### warning: non-accessible states have been removed.\n");
458 rReportStr.append(
"##### Condition (xii) repaired.\n");
460 else rReportStr.append(
"##### Condition (xii) passed.\n");
466 rReportStr.append(
"##################### Final result: #####################\n");
468 rReportStr.append(
"######### Generator is in HioEnvironmentForm. #########\n");
469 rReportStr.append(
"#########################################################\n");
473 rReportStr.append(
"########### Generator is NOT in HioEnvironmentForm. ###########\n");
474 rReportStr.append(
"#########################################################\n");
489 return IsHioEnvironmentForm(rHioEnvironment, QYe, QUe, QUl, QYlUe, ErrEvSet, ErrTrSet, ErrStSet, rReportStr);
499 std::string ReportStr;
501 return IsHioEnvironmentForm(rHioEnvironment, QYe, QUe, QUl, QYlUe, ErrEvSet, ErrTrSet, ErrStSet, ReportStr);