Exemple #1
0
 @Test
 public void testCartesianProduct3() throws FrontEndException, TLA2BException {
   final String module =
       "-------------- MODULE Testing ----------------\n"
           + "CONSTANTS k, k2 \n"
           + "ASSUME BOOLEAN \\X {1} = k \\X k2 \n"
           + "=================================";
   TestTypeChecker t = TestUtil.typeCheckString(module);
   assertEquals("POW(BOOL)", t.getConstantType("k").toString());
   assertEquals("POW(INTEGER)", t.getConstantType("k2").toString());
 }
Exemple #2
0
  @Test
  public void testTuple1() throws FrontEndException, TLA2BException {
    final String module =
        "-------------- MODULE Testing ----------------\n"
            + "EXTENDS Naturals \n"
            + "CONSTANTS k, k2 \n"
            + "ASSUME k = <<1,k2>> /\\ k2 = TRUE \n"
            + "=================================";

    TestTypeChecker t = TestUtil.typeCheckString(module);
    assertEquals("INTEGER*BOOL", t.getConstantType("k").toString());
    assertEquals("BOOL", t.getConstantType("k2").toString());
  }
Exemple #3
0
  @Test
  public void testUnifyTuple3() throws FrontEndException, TLA2BException {
    final String module =
        "-------------- MODULE Testing ----------------\n"
            + "CONSTANTS k, k2, k3 \n"
            + "ASSUME k = <<k2, <<k3>> >> /\\ k3 = TRUE /\\ k2 = 1\n"
            + "=================================";

    TestTypeChecker t = TestUtil.typeCheckString(module);
    assertEquals("INTEGER*POW(INTEGER*BOOL)", t.getConstantType("k").toString());
    assertEquals("INTEGER", t.getConstantType("k2").toString());
    assertEquals("BOOL", t.getConstantType("k3").toString());
  }
Exemple #4
0
  @Test
  public void testTupleSingleElement() throws FrontEndException, TLA2BException {
    final String module =
        "-------------- MODULE Testing ----------------\n"
            + "CONSTANTS k \n"
            + "ASSUME k = <<TRUE>> \n"
            + "=================================";

    TestTypeChecker t = TestUtil.typeCheckString(module);
    assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k").toString());
  }
Exemple #5
0
  @Test
  public void testTupleComponentsOfTheSameType() throws FrontEndException, TLA2BException {
    final String module =
        "-------------- MODULE Testing ----------------\n"
            + "EXTENDS Naturals \n"
            + "CONSTANTS k \n"
            + "ASSUME k = <<1,1>> \n"
            + "=================================";

    TestTypeChecker t = TestUtil.typeCheckString(module);
    assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k").toString());
  }
Exemple #6
0
  @Test
  public void testTupleFunctionCall2() throws FrontEndException, TLA2BException {
    final String module =
        "-------------- MODULE Testing ----------------\n"
            + "EXTENDS Naturals \n"
            + "CONSTANTS k \n"
            + "ASSUME k = <<1,TRUE,\"str\">>[3] \n"
            + "=================================";

    TestTypeChecker t = TestUtil.typeCheckString(module);
    assertEquals("STRING", t.getConstantType("k").toString());
  }
Exemple #7
0
  @Test
  public void testCartesianProduct() throws FrontEndException, TLA2BException {
    final String module =
        "-------------- MODULE Testing ----------------\n"
            + "EXTENDS Naturals \n"
            + "CONSTANTS k \n"
            + "ASSUME k = {1} \\times BOOLEAN \n"
            + "=================================";

    TestTypeChecker t = TestUtil.typeCheckString(module);
    assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k").toString());
  }