$res = $ra->_insert_path($ra->__path, 0, $path); is_deeply($res, ['t', ['' => 0, 'a' => ['a']], 'e', ['b' => ['b'], 's' => ['s']]], '_insert_path seat/set -> beat/bet'); $ra = new Regexp_Assemble(); $ra->__path = ['d', 'i', ['' => 0, 'o' => ['o']], 't', 'y', 'd']; $path = ['d', 'i', ['' => 0, 'o' => ['o']], 't', 'a', 'b']; $res = $ra->_insert_path($ra->__path, 0, $path); is_deeply($res, ['d', 'i', ['' => 0, 'o' => ['o']], 't', ['a' => ['a', 'b'], 'y' => ['y', 'd']]], '_insert_path dio?tyd -> dio?tab'); $ra = new Regexp_Assemble(); $ra->__path = ['d', 'i', ['' => 0, 'o' => ['o']], 't', ['a' => ['a', 'b'], 'y' => ['y', 'd']]]; $path = ['d', 'i', ['' => 0, 'o' => ['o']], 't', 'm', 'x']; $res = $ra->_insert_path($ra->__path, 0, $path); is_deeply($res, ['d', 'i', ['' => 0, 'o' => ['o']], 't', ['a' => ['a', 'b'], 'm' => ['m', 'x'], 'y' => ['y', 'd']]], '_insert_path dio?tmx -> dio?t(ab|yd)'); $ra = new Regexp_Assemble(); $ra->__path = ['d', 'i', ['' => 0, 'o' => ['o']], 't', ['a' => ['a', 'b'], 'y' => ['y', 'd']]]; $path = ['d', 'i', ['' => 0, 'o' => ['o']], 't', 'a', 'x']; $res = $ra->_insert_path($ra->__path, 0, $path); is_deeply($res, ['d', 'i', ['' => 0, 'o' => ['o']], 't', ['a' => ['a', ['b' => ['b'], 'x' => ['x']]], 'y' => ['y', 'd']]], '_insert_path dio?tax -> dio?t(ab|yd)'); $ra = new Regexp_Assemble(); $ra->insert('g', 'a', 'i', 't')->insert('g', 'r', 'i', 't')->insert('s', 'u', 'm', 'm', 'i', 't')->insert('s', 'u', 'b', 'm', 'i', 't')->_reduce(); is_deeply($ra->__path, [['g' => ['g', ['a' => ['a'], 'r' => ['r']]], 's' => ['s', 'u', ['b' => ['b'], 'm' => ['m']], 'm']], 'i', 't'], '/gait/ /grit/ /summit/ /submit/'); $ra = new Regexp_Assemble(); $ra->insert('g', 'a', 'i', 't')->insert('g', 'r', 'i', 't')->insert('s', 'u', 'm', 'm', 'i', 't')->insert('s', 'u', 'b', 'm', 'i', 't')->insert('i', 't')->insert('e', 'm', 'i', 't')->_reduce(); is_deeply($ra->__path, [['' => 0, 'g' => ['g', ['a' => ['a'], 'r' => ['r']]], 'e' => [['e' => ['e'], 's' => ['s', 'u', ['b' => ['b'], 'm' => ['m']]]], 'm']], 'i', 't'], '/gait/ /grit/ /summit/ /submit/ /it/ /emit/'); $ra = new Regexp_Assemble(); $ra->insert('g', 'a', 'i', 't')->insert('g', 'r', 'i', 't')->insert('l', 'i', 't')->insert('l', 'i', 'm', 'i', 't')->_reduce(); is_deeply($ra->__path, [['g' => ['g', ['a' => ['a'], 'r' => ['r']]], 'l' => ['l', ['' => 0, 'i' => ['i', 'm']]]], 'i', 't'], '/gait/ /grit/ /lit/ /limit/'); $ra = new Regexp_Assemble(); $ra->insert('g', 'a', 'i', 't')->insert('g', 'r', 'i', 't')->insert('b', 'a', 'i', 't')->insert('b', 'r', 'i', 't')->_reduce(); is_deeply($ra->__path, [['b' => ['b'], 'g' => ['g']], ['a' => ['a'], 'r' => ['r']], 'i', 't'], '/gait/ /grit/ /bait/ /brit/'); $ra = new Regexp_Assemble(); $ra->insert('g', 'a', 'i', 't')->insert('g', 'r', 'i', 't')->insert('b', 'e', 'b', 'a', 'i', 't')->insert('b', 'a', 'i', 't')->insert('b', 'r', 'i', 't')->_reduce();