diff options
Diffstat (limited to 'test/rlhc.d/case/atoi2_cs.cs-A-F0--goto-backend.exp')
-rw-r--r-- | test/rlhc.d/case/atoi2_cs.cs-A-F0--goto-backend.exp | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/test/rlhc.d/case/atoi2_cs.cs-A-F0--goto-backend.exp b/test/rlhc.d/case/atoi2_cs.cs-A-F0--goto-backend.exp new file mode 100644 index 00000000..f97ebacf --- /dev/null +++ b/test/rlhc.d/case/atoi2_cs.cs-A-F0--goto-backend.exp @@ -0,0 +1,187 @@ +using System; +// Disables lots of warnings that appear in the test suite +#pragma warning disable 0168, 0169, 0219, 0162, 0414 +namespace Test { + class Test + { + int neg; + int value; + + + + + static readonly sbyte []_state_chart_actions = { 0, 1, 0, 1, 2, 2, 0, 1, 2, 0, 2, 2, 3, 4, 0, }; + static readonly char []_state_chart_trans_keys = { '\u0001', '\u0000', '\u0004', '\u0004', '\u0000', '\u0004', '\u0002', '\u0004', '\u0000', }; + static readonly sbyte []_state_chart_char_class = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, }; + static readonly sbyte []_state_chart_index_offsets = { 0, 0, 1, 6, 0, }; + static readonly sbyte []_state_chart_indicies = { 0, 2, 1, 1, 1, 0, 3, 4, 5, 0, }; + static readonly sbyte []_state_chart_index_defaults = { 0, 1, 1, 1, 0, }; + static readonly sbyte []_state_chart_trans_cond_spaces = { -1, -1, -1, -1, -1, -1, 0, }; + static readonly sbyte []_state_chart_cond_targs = { 2, 0, 3, 1, 1, 2, 0, }; + static readonly sbyte []_state_chart_cond_actions = { 3, 0, 11, 1, 5, 8, 0, }; + static readonly sbyte []_state_chart_nfa_targs = { 0, 0, }; + static readonly sbyte []_state_chart_nfa_offsets = { 0, 0, 0, 0, 0, }; + static readonly sbyte []_state_chart_nfa_push_actions = { 0, 0, }; + static readonly sbyte []_state_chart_nfa_pop_trans = { 0, 0, }; + static readonly int state_chart_start = 3; + static readonly int state_chart_first_final = 3; + static readonly int state_chart_error = 0; + static readonly int state_chart_en_main = 3; + int cs; + + void init() + { + value = 0; + neg = 0; + + { + cs = (int)state_chart_start; + } + } + + void exec( char[] data, int len ) + { + int p = 0; + int pe = len; + int eof = len; + string _s; + char [] buffer = new char [1024]; + int blen = 0; + + { + int _trans = 0; + int _acts; + uint _nacts; + int _keys; + int _inds; + if ( p == pe ) + goto _test_eof; + + if ( cs == 0 ) + goto _out; + + _resume : + _keys = (cs<<1) ; + _inds = _state_chart_index_offsets[cs] ; + if ( ( data[p ]) <= 57&& ( data[p ]) >= 10 ) + { + int _ic = (int)_state_chart_char_class[(int)( data[p ]) - 10]; + if ( _ic <= (int)_state_chart_trans_keys[_keys+1]&& _ic >= (int)_state_chart_trans_keys[_keys ] ) + _trans = (int)_state_chart_indicies[_inds + (int)( _ic - (int)_state_chart_trans_keys[_keys ]) ]; + + else + _trans = (int)_state_chart_index_defaults[cs]; + + } + + else + { + _trans = (int)_state_chart_index_defaults[cs]; + } + + + goto _match_cond; + + _match_cond : + cs = (int)_state_chart_cond_targs[_trans]; + if ( _state_chart_cond_actions[_trans] == 0 ) + goto _again; + + + _acts = _state_chart_cond_actions[_trans] ; + _nacts = (uint )_state_chart_actions[_acts ]; + _acts += 1; + while ( _nacts > 0 ) + { + switch ( _state_chart_actions[_acts ] ) { + case 0: + {neg = 0; + value = 0; + } + + break; + case 1: + {neg = 1; + } + + break; + case 2: + {value = value * 10 + ( int ) ( (( data[p ])) - 48 ) + ; + } + + break; + case 3: + {if ( neg != 0 ) + { + value = -1 * value; + + } + } + + break; + case 4: + {Console.Write( value );Console.Write( "\n" );} + + break; + + } + _nacts -= 1; + _acts += 1; + } + + + + + _again : + if ( cs == 0 ) + goto _out; + + p += 1; + if ( p != pe ) + goto _resume; + + + _test_eof : + {} + + _out : + {} + + } + } + + void finish( ) + { + if ( cs >= state_chart_first_final ) + Console.WriteLine( "ACCEPT" ); + else + Console.WriteLine( "FAIL" ); + } + + static readonly string[] inp = { + "1\n", + "12\n", + "222222\n", + "+2123\n", + "213 3213\n", + "-12321\n", + "--123\n", + "-99\n", + " -3000\n", + }; + + + static readonly int inplen = 9; + + public static void Main (string[] args) + { + Test machine = new Test(); + for ( int i = 0; i < inplen; i++ ) { + machine.init(); + machine.exec( inp[i].ToCharArray(), inp[i].Length ); + machine.finish(); + } + } + } +} |