Package urban.transformers

Source Code of urban.transformers.ShapeToRuleTransformerTest

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());
  }

}
TOP

Related Classes of urban.transformers.ShapeToRuleTransformerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.