ps.load( Tools.findRelativeSystemPath( "conf/system.conf" ) );
TextualTransformManagerTable ttmt = new TextualTransformManagerTable( ps );
BasicUnitList bul = new BasicUnitList();
ReplaceDirective rd = new ReplaceDirective();
assertEquals( "replace", rd.getName() );
ttmt = new TextualTransformManagerTable( ps );
rd = new ReplaceDirective();
rd.perform( "replace", " a b ", bul, tahs, ps, ttmt, tm );
assertEquals( "xbx", ttmt.getTextTTM().transform( "xax" ) );
ttmt = new TextualTransformManagerTable( ps );
rd = new ReplaceDirective();
rd.perform( "replace/first", " a b ", bul, tahs, ps, ttmt, tm);
assertEquals( "xbxax", ttmt.getTextTTM().transform( "xaxax" ) );
ttmt = new TextualTransformManagerTable( ps );
rd = new ReplaceDirective();
rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
rd.perform( "replace", " b 2 ", bul, tahs, ps, ttmt, tm );
assertEquals( "x1x2x", ttmt.getTextTTM().transform( "xaxbx" ) );
ttmt = new TextualTransformManagerTable( ps );
rd = new ReplaceDirective();
rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt, tm );
assertEquals( "x1x2xbx1x", ttmt.getTextTTM().transform( "xaxbxbxax" ) );
ttmt = new TextualTransformManagerTable( ps );
rd = new ReplaceDirective();
rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt, tm );
assertEquals( "12b1", ttmt.getTextTTM().transform( "abba" ) );
ttmt = new TextualTransformManagerTable( ps );
rd = new ReplaceDirective();
rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt, tm );
assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );
ttmt = new TextualTransformManagerTable( ps );
rd = new ReplaceDirective();
rd.perform( "replace/first", " a 1 ", bul, tahs, ps, ttmt, tm );
rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt, tm );
assertEquals( "12a", ttmt.getTextTTM().transform( "ababa" ) );
ttmt = new TextualTransformManagerTable( ps );
rd = new ReplaceDirective();
rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
rd.perform( "replace/first", " bab 2 ", bul, tahs, ps, ttmt, tm );
assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );
}