Package nz.ac.waikato.modeljunit.examples

Examples of nz.ac.waikato.modeljunit.examples.FSM


    return new TestSuite(ModelTest.class);
  }

  public static void testReflection()
  {
    FSM sut = new FSM();
    Model model = new Model(sut);
    assertEquals(sut, model.getModel());
    assertEquals(FSM.class, model.getModelClass());
    assertEquals("nz.ac.waikato.modeljunit.examples.FSM",
        model.getModelName());
View Full Code Here


  }


  public static void testFlag()
  {
    FSM sut = new FSM();
    Model model = new Model(sut);
    assertTrue(model.getTesting());
    assertTrue(model.setTesting(false));
    assertFalse(model.getTesting());
    assertFalse(model.setTesting(true));
View Full Code Here

    assertTrue(model.getTesting());
  }

  public static void testOutput()
  {
    FSM sut = new FSM();
    Model model = new Model(sut);
    Writer wr0 = model.getOutput();
    assertTrue(wr0 instanceof OutputStreamWriter);
    Writer wr1 = new StringWriter();
    assertEquals(wr0, model.setOutput(wr1));
View Full Code Here

    assertEquals("test\nWarning: warning\n", wr1.toString());
  }

  public static void testEnabled()
  {
    Model model = new Model(new FSM());
    int action0 = model.getActionNumber("action0");
    int action1 = model.getActionNumber("action1");
    int action2 = model.getActionNumber("action2");
    int actionNone = model.getActionNumber("actionNone");
    Object s0 = model.getCurrentState();
View Full Code Here

    }
  }

  public void testListener()
  {
    Model model = new Model(new FSM());
    ModelListener dummy = new AbstractListener()
      {
        public String getName() {return "dummy";}
        @Override public void doneReset(String reason, boolean testing)
        {
View Full Code Here

public class SimpleMBTTest
{
  @Test 
  public void testMBTTest() {
  SimpleMBT tester = new SimpleMBT(new FSM());
  try {
    String action = tester.generate();
    assertTrue(action.startsWith("action") || action.startsWith("reset"));
  } catch (Exception e) {
    e.printStackTrace();
View Full Code Here

  {
    return new TestSuite(ModelTestCaseTest.class);
  }

  public static void testProperties() {
    FSM fsm = new FSM();
    ModelTestCase model = new ModelTestCase(fsm);
    model.allRoundTrips(100);
    model.randomWalk(4);
    model.setVerbosity(3);
    model.setResetProbability(0.1);
View Full Code Here

   
   
  }
 
  public static void testSetInvalidResetProbablility() {
    ModelTestCase model = new ModelTestCase(new FSM());
    try {
      model.setResetProbability(2);
    } catch (IllegalArgumentException e) {
      Assert.assertEquals("illegal reset probability: 2.0", e.getMessage());
   
View Full Code Here

   
  }
 
  public static void testEnabled()
  {
    ModelTestCase model = new ModelTestCase(new FSM());
    model.doReset(true);
    Assert.assertEquals("0", model.getCurrentState());
    int action0 = model.fsmFindAction("action0");
    int action1 = model.fsmFindAction("action1");
    int action2 = model.fsmFindAction("action2");
View Full Code Here

  }

  /** This tests a random walk, plus ActionCoverage metric with history.*/
  public static void testRandomWalk()
  {
    ModelTestCase model = new ModelTestCase(new FSM());
    CoverageHistory metric = new CoverageHistory(new ActionCoverage(), 1);
    model.addCoverageMetric(metric);
    model.randomWalk(4); // 4 transitions plus a few resets
    int coverage = metric.getCoverage();
    Assert.assertEquals(3, coverage);
View Full Code Here

TOP

Related Classes of nz.ac.waikato.modeljunit.examples.FSM

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.