diff options
Diffstat (limited to 'test/rlhc.d/case/minimize1.c-C-G1--goto-backend.exp')
-rw-r--r-- | test/rlhc.d/case/minimize1.c-C-G1--goto-backend.exp | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/test/rlhc.d/case/minimize1.c-C-G1--goto-backend.exp b/test/rlhc.d/case/minimize1.c-C-G1--goto-backend.exp new file mode 100644 index 00000000..b0ce193f --- /dev/null +++ b/test/rlhc.d/case/minimize1.c-C-G1--goto-backend.exp @@ -0,0 +1,137 @@ +#include <stdio.h> +#include <string.h> + +struct min +{ + int cs; +}; + + + +static const char _min_nfa_targs [] = { 0, 0 , }; +static const char _min_nfa_offsets [] = { 0, 0, 0, 0, 0 , }; +static const char _min_nfa_push_actions [] = { 0, 0 , }; +static const char _min_nfa_pop_trans [] = { 0, 0 , }; +static const int min_start = 1; +static const int min_first_final = 3; +static const int min_error = 0; +static const int min_en_main = 1; +void min_init( struct min *fsm ) +{ + + { + (fsm->cs) = ( int ) min_start; + } +} + +void min_execute( struct min *fsm, const char *_data, int _len ) +{ + const char *p = _data; + const char *pe = _data+_len; + + + { + if ( p == pe ) + goto _test_eof; + + if ( (fsm->cs) == 0 ) + goto _out; + + _resume: + switch ( (fsm->cs) ) { + case 1: + if ( 97 <= ((*( p )) + )&& ((*( p )) + )<= 98 ) + { + goto ctr0; + } + + { + goto ctr1; + } + case 0: + goto _out; + case 2: + if ( ((*( p )) + )== 10 ) + { + goto ctr2; + } + + if ( 97 <= ((*( p )) + )&& ((*( p )) + )<= 98 ) + { + goto ctr3; + } + + { + goto ctr1; + } + case 3: + { + goto ctr1; + } + + } + ctr1: (fsm->cs) = 0; + goto _again; + ctr0: (fsm->cs) = 2; + goto _again; + ctr3: (fsm->cs) = 2; + goto f0; + ctr2: (fsm->cs) = 3; + goto _again; + + f0: + { + printf("a or b\n"); + } + + goto _again; + + _again: + if ( (fsm->cs) == 0 ) + goto _out; + + p+= 1; + if ( p != pe ) + goto _resume; + + _test_eof: {} + _out: {} + } +} + +int min_finish( struct min *fsm ) +{ + if ( fsm->cs == min_error ) + return -1; + if ( fsm->cs >= min_first_final ) + return 1; + return 0; +} + +struct min fsm; + +void test( char *buf ) +{ + int len = strlen( buf ); + min_init( &fsm ); + min_execute( &fsm, buf, len ); + if ( min_finish( &fsm ) > 0 ) + printf("ACCEPT\n"); + else + printf("FAIL\n"); +} + + +int main() +{ + test( "aaaaaa\n" ); + test( "a\n" ); + test( "abc\n" ); + return 0; +} + |