package urban.transformers;
import static org.junit.Assert.*;
import org.antlr.runtime.RecognitionException;
import org.junit.Test;
import urban.model.Model;
import static urban.parser.UrbanParser.parse;
public class ShapeToRuleTransformerTest {
private ShapeToRuleTransformer t = new ShapeToRuleTransformer();
@Test
public void testTransform() throws RecognitionException {
Model m = parse(
"%gen: 'G' P(f~0) <-> P(f~1) := 1.150514997831991\n"+
"%shape: 'S1' P(f~1,l!1),P(f~1,r!1) := -1\n"+
"%shape: 'S2' P(f~0,l!1),P(f~0,r!1) := -1\n"+
"%shape: 'S3' P(f~1) := 0.301029995663981\n").model();
String expected =
"#gen: 'G' P(f~0) <-> P(f~1) := 1.1505149978\n"+
"P(f~0, l!1, r!2),P(f~0, r!1),P(f~0, l!2) <-> P(f~1, l!1, r!2),P(f~0, r!1),P(f~0, l!2) @ 0, 0\n"+
"P(f~0, l!1, r!2),P(f~0, r!1),P(f~1, l!2) <-> P(f~1, l!1, r!2),P(f~0, r!1),P(f~1, l!2) @ 0, 0\n"+
"P(f~0, l!1, r!2),P(f~1, r!1),P(f~0, l!2) <-> P(f~1, l!1, r!2),P(f~1, r!1),P(f~0, l!2) @ 0, 0\n"+
"P(f~0, l!1, r!2),P(f~1, r!1),P(f~1, l!2) <-> P(f~1, l!1, r!2),P(f~1, r!1),P(f~1, l!2) @ 0, 0\n"
;
assertEquals(expected, t .transform(m).toString());
}
}