Package nz.ac.waikato.modeljunit.timing

Examples of nz.ac.waikato.modeljunit.timing.TimedModel


   * @param fsm  Must be non-null.
   */
  public Tester(FsmModel fsm)
  {
    if(fsm instanceof TimedFsmModel)
      model_ = new TimedModel((TimedFsmModel)fsm);
    else
      model_ = new Model(fsm);
  }
View Full Code Here


   * @param fsm  Must be non-null.
   */
  public Tester(FsmModel fsm)
  {
      this(fsm instanceof TimedFsmModel
              ? new TimedModel((TimedFsmModel)fsm)
              : new Model(fsm));
  }
View Full Code Here

   * @throws FileNotFoundException
   */
  public static void main(String[] args) throws FileNotFoundException
  {
    final int experiments = 100;
    TimedModel model = new TimedModel(new SimpleTimedLight());
    Tester tester = new RandomTester(model);
    //tester.addListener(new VerboseListener());
    double origProb = model.getTimeoutProbability();
    model.setTimeoutProbability(0.3); // while exploring the FSM
    GraphListener graph = tester.buildGraph();
    model.setTimeoutProbability(origProb);
    graph.printGraphDot("SimpleTimedLight.dot");
    System.out.println("FSM has " + graph.getGraph().numVertices() + " states and "
        + graph.getGraph().numEdges() + " transitions");
    CoverageMetric metric = tester.addCoverageMetric(new TransitionCoverage());
    for (double prob = 0.1; prob < 0.99; prob += 0.1) {
      model.setTimeoutProbability(prob);
      double totalSteps = 0.0;
      int totalTime = 0; // sum of all the totalTimes.
      for (int seed = 0; seed < experiments; seed++) {
        int testSeqTime = 0;
        int lastTime = 0; // the time after the last transition
        metric.clear();
        tester.reset();
        tester.setRandom(new Random(seed));
        int count = 0;
        while (metric.getPercentage() < 100.0) {
          tester.generate(1);
          if (model.getTime() > lastTime) {
            lastTime = model.getTime();
          } else {
            testSeqTime += lastTime;
            //System.out.println("added " + lastTime + " secs");
            lastTime = 0;
          }
View Full Code Here

    allowCarsTimer = now + SAFETY_PERIOD;
  }

  public static void main(String[] args)
  {
    TimedModel model = new TimedModel(new TrafficLight());
    Tester tester = new RandomTester(model);
    //tester.addListener("verbose");
    //GraphListener graphListener = tester.buildGraph();
   
    try {
View Full Code Here

TOP

Related Classes of nz.ac.waikato.modeljunit.timing.TimedModel

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.