Package urban.transformers

Source Code of urban.transformers.AddPinchesModelTransformerTest

package urban.transformers;

import static org.junit.Assert.*;
import static urban.parser.UrbanParser.parse;

import org.antlr.runtime.RecognitionException;
import org.junit.Test;

import urban.model.Model;

public class AddPinchesModelTransformerTest {

  @Test
  public void testPinches() throws RecognitionException {
    Model m = parse("P(x!1,y!2),P(y!1),P(x!2) <-> P(x!1,y!2),P(y!1),P(x!2) @ 1,2\n").model();

    m = new AddPinchesModelTransformer().transform(m);
   
    assertEquals("P(x!1, y!2),P(y!1),P(x!2) <-> P(x!1, y!2),P(y!1),P(x!2) @ 1, 2\n"+
        "P(x!1, y!2),P(x!2, y!1) <-> P(x!1, y!2),P(x!2, y!1) @ 1, 2\n",m.toString());
  }

  @Test
  public void testPinches_NoPinch() throws RecognitionException {
    Model pre = parse("P(f~0,x!1,y!2),P(f~1,y!1),P(f~0,x!2) <-> P(f~1,x!1,y!2),P(f~1,y!1),P(f~0,x!2) @ 1,2\n").model();

    Model post = new AddPinchesModelTransformer().transform(pre);
   
    assertEquals(pre.toString(),post.toString());
  }
 
  @Test
  public void testPinches2() {
/*    m = parse("* 'flip' A(f~0) <-> A(f~1)\n"+
        "'bind' A(z),A(z) <-> A(z!1),A(z!1) @ 1,1\n"+
        "'bind' A(w),A(z) <-> A(w!1),A(z!1) @ 1,1\n"+
    "'bind' A(x),A(y) <-> A(x!1),A(y!1) @ 1,1\n");

    FRule rule = m.getFRule("flip");
   
    Collection<FRule> expandBindings = rule.expandBindings(m);
    assertEquals(90, expandBindings.size());*/
  }
 
TOP

Related Classes of urban.transformers.AddPinchesModelTransformerTest

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.