Package statechum.analysis.learning.TestFSMAlgo

Examples of statechum.analysis.learning.TestFSMAlgo.FSMStructure


   */
  public void checkLoading(FSMStructure gr) throws IOException
  {
    final Configuration config = Configuration.getDefaultConfiguration();
    StringWriter writer = new StringWriter();gr.transform322.writeGraphML(writer);
    FSMStructure loaded = FSMStructure.loadGraph(new StringReader(writer.toString()),config);

    Assert.assertTrue(!WMethod.checkUnreachableStates(gr));Assert.assertTrue(!WMethod.checkUnreachableStates(loaded));
    Assert.assertNull(checkM(gr,loaded));
   
    for(List<String> stateCoverSeq:WMethod.computeStateCover(gr))
    {
      String a = gr.getVertex(stateCoverSeq), b=loaded.getVertex(stateCoverSeq);
      Assert.assertEquals(gr.accept.get(a),loaded.accept.get(b));
    }

  }
View Full Code Here


  }

  @Test
  public final void testGraphMLWriter3() throws IOException
  {
    FSMStructure fsm = new FSMStructure(TestFSMAlgo.buildGraph(TestRpniLearner.largeGraph1_invalid5, "testMerge_fail1"),Configuration.getDefaultConfiguration());
    checkLoading(fsm);
  }
View Full Code Here

  }
 
  @Test
  public final void testGraphMLWriter4() throws IOException
  {
    FSMStructure fsm = new FSMStructure(TestFSMAlgo.buildGraph(TestRpniLearner.largeGraph1_invalid5, "testMerge_fail1"),Configuration.getDefaultConfiguration());
    fsm.accept.put(fsm.findVertex("BB1"),false);
    checkLoading(fsm);
  }
View Full Code Here

  }

  @Test
  public final void testGraphMLWriter5() throws IOException
  {
    FSMStructure fsm = new FSMStructure(TestFSMAlgo.buildGraph("S-a->A\nS-b->B\nS-c->C\nS-d->D\nS-e->E\nS-f->F\nS-h->H-d->H\nA-a->A1-b->A2-a->K1-a->K1\nB-a->B1-z->B2-b->K1\nC-a->C1-b->C2-a->K2-b->K2\nD-a->D1-b->D2-b->K2\nE-a->E1-b->E2-a->K3-c->K3\nF-a->F1-b->F2-b->K3","testCheckEquivalentStates1"),Configuration.getDefaultConfiguration());
    checkLoading(fsm);
  }
View Full Code Here

  }

  @Test
  public final void testGraphMLWriter_load__despite_Initial() throws IOException
  {
    FSMStructure gr = new FSMStructure(TestFSMAlgo.buildGraph(TestRpniLearner.largeGraph1_invalid5, "testMerge_fail1"),Configuration.getDefaultConfiguration());
    StringWriter writer = new StringWriter();gr.transform322.writeGraphML(writer);
    synchronized (computeStateScores.syncObj)
    {// ensure that the calls to Jung's vertex-creation routines do not occur on different threads.
        GraphMLFile graphmlFile = new GraphMLFile();
        graphmlFile.setGraphMLFileHandler(new ExperimentGraphMLHandler());
        Graph brokenGraph=graphmlFile.load(new StringReader(writer.toString().replace("VERTEX=\"BB1\"", "VERTEX=\""+Transform322.Initial+" BB1\"")));
        try
        {
          new FSMStructure(brokenGraph,Configuration.getDefaultConfiguration());
        }
        catch(IllegalArgumentException ex)
        {
          Assert.assertTrue(ex.getMessage().contains("duplicate initial state"));
        }
View Full Code Here

  @Test
  public final void testLearnerEvaluation1()
  {
    LearnerSimulator loader = new LearnerSimulator(new ByteArrayInputStream(xmlData.getBytes()),false);
    LearnerEvaluationConfiguration cnf=ProgressDecorator.readLearnerEvaluationConfiguration(loader.expectNextElement(ELEM_KINDS.ELEM_EVALUATIONDATA.name()));
    TestFSMAlgo.checkM(new FSMStructure(cnf.graph,null), new FSMStructure(graph,null));
    Assert.assertEquals(testData, cnf.testSet);
    Assert.assertEquals(config, cnf.config);
    Assert.assertEquals(ltl,cnf.ltlSequences);
  }
View Full Code Here

   
    dumper.topElement.appendChild(learnerConfig);dumper.close();xmlData = output.toString();
   
    LearnerSimulator loader = new LearnerSimulator(new ByteArrayInputStream(xmlData.getBytes()),false);
    LearnerEvaluationConfiguration cnf=ProgressDecorator.readLearnerEvaluationConfiguration(loader.expectNextElement(ELEM_KINDS.ELEM_EVALUATIONDATA.name()));
    TestFSMAlgo.checkM(new FSMStructure(cnf.graph,null), new FSMStructure(graph,null));
    Assert.assertEquals(testData, cnf.testSet);Assert.assertEquals(anotherconfig, cnf.config);
    Assert.assertEquals(ltl,cnf.ltlSequences);
  }
View Full Code Here

    learnerConfig.appendChild(dumper.doc.createElement("junk"));
    dumper.topElement.appendChild(learnerConfig);dumper.close();xmlData = output.toString();
   
    final LearnerSimulator loader = new LearnerSimulator(new ByteArrayInputStream(xmlData.getBytes()),false);
    LearnerEvaluationConfiguration cnf=ProgressDecorator.readLearnerEvaluationConfiguration(loader.expectNextElement(ELEM_KINDS.ELEM_EVALUATIONDATA.name()));
    TestFSMAlgo.checkM(new FSMStructure(cnf.graph,null), new FSMStructure(graph,null));
    Assert.assertEquals(testData, cnf.testSet);
    Assert.assertEquals(config, cnf.config);
    Assert.assertEquals(ltl,cnf.ltlSequences);
 
View Full Code Here

    }
    Assert.assertEquals(anotherXML,xmlData);
   
    LearnerSimulator loader = new LearnerSimulator(new ByteArrayInputStream(xmlData.getBytes()),false);
    LearnerEvaluationConfiguration cnf=ProgressDecorator.readLearnerEvaluationConfiguration(loader.expectNextElement(ELEM_KINDS.ELEM_EVALUATIONDATA.name()));
    TestFSMAlgo.checkM(new FSMStructure(cnf.graph,null), new FSMStructure(graph,null));
    Assert.assertEquals(testData, cnf.testSet);Assert.assertEquals(anotherconfig, cnf.config);
    Assert.assertNull(cnf.ltlSequences);
  }
View Full Code Here

  public final void testLearnerEvaluation5()
  {
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    RecordProgressDecorator dumper = new RecordProgressDecorator(null,output,1,Configuration.getDefaultConfiguration(),false);
    Element learnerConfig = dumper.writeLearnerEvaluationConfiguration(new LearnerEvaluationConfiguration(graph,testData,anotherconfig,ltl));
    learnerConfig.appendChild(new FSMStructure(TestFSMAlgo.buildGraph("A-a->A", "testLoadInit_fail7"),Configuration.getDefaultConfiguration())
    .transform322.createGraphMLNode(dumper.doc));
    dumper.topElement.appendChild(learnerConfig);dumper.close();xmlData = output.toString();
   
    final LearnerSimulator loader = new LearnerSimulator(new ByteArrayInputStream(xmlData.getBytes()),false);
    checkForCorrectException(new whatToRun() { public void run() {
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.TestFSMAlgo.FSMStructure

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.