Package fitnesse.slim.instructions

Examples of fitnesse.slim.instructions.CallInstruction


  public void canBuildInstructionsForSimpleDecisionTable() throws Exception {
    makeDynamicDecisionTableAndBuildInstructions(simpleDynamicDecisionTable);
    int n = 0;
    List<Instruction> expectedInstructions = asList(
            new MakeInstruction(id(n++), TABLE_INSTANCE_NAME, "fixture", new Object[]{"argument"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "table", new Object[]{asList(asList("var", "func?"), asList("3", "5"), asList("7", "9"))}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "beginTable"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "3"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "7"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "endTable")

    );
    assertEquals(expectedInstructions, instructions);
  }
View Full Code Here


            "|7|9|\n";
    makeDynamicDecisionTableAndBuildInstructions(decisionTableWithSameSetterMultipleTimes);
    int n = 0;
    List<Instruction> expectedInstructions = asList(
            new MakeInstruction(id(n++), TABLE_INSTANCE_NAME, "fixture", new Object[]{"argument"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "table", new Object[]{asList(asList("var", "var"), asList("3", "5"), asList("7", "9"))}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "beginTable"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "3"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "5"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "7"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "9"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "endTable")

    );
    assertEquals(expectedInstructions, instructions);
  }
View Full Code Here

  public void canBuildInstructionsForMultipleCallsToSameFunction() throws Exception {
    makeDynamicDecisionTableAndBuildInstructions(dynamicDecisionTableWithSameFunctionMultipleTimes);
    int n = 0;
    List<Instruction> expectedInstructions = asList(
            new MakeInstruction(id(n++), TABLE_INSTANCE_NAME, "fixture", new Object[]{"argument"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "table", new Object[]{asList(asList("func?", "func?"), asList("3", "5"), asList("7", "9"))}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "beginTable"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "endTable")

    );
    assertEquals(expectedInstructions, instructions);
  }
View Full Code Here

      "|3|5|\n" +
      "|7|9|\n");
    int n=0;
    List<Instruction> expectedInstructions = asList(
            new MakeInstruction(id(n++), TABLE_INSTANCE_NAME, "fixture", new Object[]{"argument"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "table", new Object[]{asList(asList("var", "func!"), asList("3", "5"), asList("7", "9"))}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "beginTable"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "3"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "7"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "endTable")
    );
    assertEquals(expectedInstructions, instructions);
  }
View Full Code Here

      "|a|a|b|b|c|c|d|e|f|d|e|f|\n");
    int n = 0;

    List<Instruction> expectedInstructions = asList(
            new MakeInstruction(id(n++), TABLE_INSTANCE_NAME, "fixture"),
            new CallInstruction(id(n++),TABLE_INSTANCE_NAME, "table", new Object[] {asList(
                asList("a", "fa?", "b", "fb?", "c", "fc?", "d", "e", "f", "fd?", "fe?", "ff?"),
                asList("a", "a", "b", "b", "c", "c", "d", "e", "f", "d", "e", "f"))}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "beginTable"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"a", "a"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"b", "b"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"c", "c"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"d", "d"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"e", "e"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"f", "f"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"fa"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"fb"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"fc"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"fd"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"fe"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"ff"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "endTable")
    );
    assertEquals(expectedInstructions, instructions);
  }
View Full Code Here

        "|$V|9|\n"
    );
    int n=0;
    List<Instruction> expectedInstructions = asList(
            new MakeInstruction(id(n++), TABLE_INSTANCE_NAME, "fixture"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "table", new Object[]{asList(asList("var", "func?"), asList("3", "$V="), asList("$V", "9"))}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "beginTable"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "3"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallAndAssignInstruction(id(n++), "V", TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "reset"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "set", new Object[]{"var", "$V"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "execute"),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "get", new Object[]{"func"}),
            new CallInstruction(id(n++), TABLE_INSTANCE_NAME, "endTable")
    );
    assertEquals(expectedInstructions.toString(), instructions.toString());
  }
View Full Code Here

    makeDynamicDecisionTableAndBuildInstructions(
      "|DDT:fixture|\n" +
        "|my var|my func?|\n" +
        "|8|7|\n"
    );
    CallInstruction setInstruction = new CallInstruction(id(4), TABLE_INSTANCE_NAME, "set", new Object[]{"my var", "8"});
    CallInstruction callInstruction = new CallInstruction(id(6), TABLE_INSTANCE_NAME, "get", new Object[]{"my func"});
    assertEquals(setInstruction, instructions.get(4));
    assertEquals(callInstruction, instructions.get(6));
  }
View Full Code Here

  @Test
  public void simpleFunctionCall() throws Exception {
    buildInstructionsFor("|function|\n", false);
    List<CallInstruction> expectedInstructions =
      asList(
              new CallInstruction("scriptTable_id_0", "scriptTableActor", "function")
      );
    assertEquals(expectedInstructions, instructions());
  }
View Full Code Here

  @Test
  public void functionCallWithOneArgument() throws Exception {
    buildInstructionsFor("|function|arg|\n", false);
    List<CallInstruction> expectedInstructions =
      asList(
              new CallInstruction("scriptTable_id_0", "scriptTableActor", "function", new Object[]{"arg"})
      );
    assertEquals(expectedInstructions, instructions());
  }
View Full Code Here

  @Test
  public void functionCallWithOneArgumentAndTrailingName() throws Exception {
    buildInstructionsFor("|function|arg|trail|\n", false);
    List<CallInstruction> expectedInstructions =
      asList(
              new CallInstruction("scriptTable_id_0", "scriptTableActor", "functionTrail", new Object[]{"arg"})
      );
    assertEquals(expectedInstructions, instructions());
  }
View Full Code Here

TOP

Related Classes of fitnesse.slim.instructions.CallInstruction

Copyright © 2018 www.massapicom. 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.