Package statechum

Examples of statechum.StringVertex


   */
  @Test
  public final void testCreateLabelToStateMap9() // test for correct detection of nondeterminism
  {
    checkForCorrectException(new whatToRun() { public @Override void run() {
      createLabelToStateMap(labelList(new String[] {"b","b"}), new StringVertex("A"),null);
    }},IllegalArgumentException.class,"duplicate");
  }
View Full Code Here


 
  /** test for correct data being added in the case of nondeterminism. */
  @Test
  public final void testCreateLabelToStateMap_nondet1()
  {
    Map<Label,List<CmpVertex>> trans = createLabelToStateMap(labelList(new String[] {"t"}), new StringVertex("A"),
      createLabelToStateMap(AbstractLearnerGraph.buildList(Arrays.asList(new String[] {"b","e"}),config,converter), new StringVertex("A"),
        createLabelToStateMap(AbstractLearnerGraph.buildList(Arrays.asList(new String[] {"f"}),config,converter), new StringVertex("C"),null)));
    List<CmpVertex>
      A=Arrays.asList(new CmpVertex[]{new StringVertex("A")}),
      C=Arrays.asList(new CmpVertex[]{new StringVertex("C")}),
      AC=Arrays.asList(new CmpVertex[]{new StringVertex("A"),new StringVertex("C")});
      Map<Label,List<CmpVertex>> expected = new HashMap<Label,List<CmpVertex>>();
      expected.put(lb("e"),AC);expected.put(lb("b"),AC);expected.put(lb("f"), C);expected.put(lb("t"), A);
    assertSame(trans,createLabelToStateMap(labelList(new String[] {"b","e"}), new StringVertex("C"),trans));
    assertEquals(expected,trans);
  }
View Full Code Here

  /** Empty row. */
  @Test
  public final void testRowConversion0()
  {
    CmpVertex A = new StringVertex("A");
    LearnerGraph graph = new LearnerGraph(confString);
    @SuppressWarnings("unchecked")
    Map<Label,CmpVertex> actual=convertRowToDet(graph,Collections.EMPTY_MAP, null, A),
      expected = graph.createNewRow();
    assertEquals(expected,actual);
View Full Code Here

  /** Row with a single entry. */
  @Test
  public final void testRowConversion1()
  {
    CmpVertex A = new StringVertex("A"), B = new StringVertex("B");
    LearnerGraph graph = new LearnerGraph(confString);
    Map<Label,CmpVertex> actual=convertRowToDet(graph,createLabelToStateMap(labelList(new String[] {"a"}),B,null), null, A),
      expected = graph.createNewRow();
    expected.put(lb("a"), B);
    assertEquals(expected,actual);
View Full Code Here

  /** Row with a number of entries including a loop. */
  @Test
  public final void testRowConversion2()
  {
    CmpVertex A = new StringVertex("A"), B = new StringVertex("B"), C = new StringVertex("C");
    LearnerGraph graph = new LearnerGraph(confString);
    Map<Label,CmpVertex> actual=convertRowToDet(graph,
            createLabelToStateMap(labelList(new String[] {"a","b"}),B,
                createLabelToStateMap(labelList(new String[] {"e"}),A,
                    createLabelToStateMap(labelList(new String[] {"c","d"}),C,null))), null, A),
View Full Code Here

  /** Row with multiple entries and a map for renumbering of vertices. */
  @Test
  public final void testRowConversion2_renumbered()
  {
    CmpVertex A = new StringVertex("A"), B = new StringVertex("B"), C = new StringVertex("C"),
      newA = new StringVertex("newA"),newB = new StringVertex("newB"), newC = new StringVertex("newC");
    Map<CmpVertex,CmpVertex> oldToNew = new TreeMap<CmpVertex,CmpVertex>();oldToNew.put(A,newA);oldToNew.put(B,newB);oldToNew.put(C,newC);
    LearnerGraph graph = new LearnerGraph(confString);
    Map<Label,CmpVertex> actual=convertRowToDet(graph,
            createLabelToStateMap(labelList(new String[] {"a","b"}),B,
                createLabelToStateMap(labelList(new String[] {"e"}),A,
View Full Code Here

  /** Non-determinism on transition a. */
  @Test
  public final void testRowConversion_nondet1()
  {
    final CmpVertex A = new StringVertex("A"), B = new StringVertex("B"), C = new StringVertex("C");
    final LearnerGraph graph = new LearnerGraph(confString);
   
    checkForCorrectException(new whatToRun() { public @Override void run() {
      convertRowToDet(graph,createLabelToStateMap(labelList(new String[] {"a","b"}),B,createLabelToStateMap(labelList(new String[] {"a"}),C,null)), null,A);
    }},IllegalArgumentException.class,"non-deterministic");
View Full Code Here

  /** Transition with an empty target state list. */
  @Test
  public final void testRowConversion_nondet2()
  {
    final CmpVertex A = new StringVertex("A");
    final LearnerGraph graph = new LearnerGraph(confString);
   
    checkForCorrectException(new whatToRun() { public @Override void run() {
      Map<Label,List<CmpVertex>> nondetRow = new TreeMap<Label,List<CmpVertex>>();nondetRow.put(lb("a"), new LinkedList<CmpVertex>());
      convertRowToDet(graph,nondetRow, null,A);
View Full Code Here

  public final void testGraphConstruction1a()
  {
    confString.setUseOrderedEntrySet(true);config.setUseOrderedEntrySet(true);
    LearnerGraph expected = new LearnerGraph(confString);expected.initEmpty();
    LearnerGraph graph = buildLearnerGraph("A--a-->B-b->C-c->A","testConstruction1",config,converter);
    CmpVertex A = new StringVertex("A"), B = new StringVertex("B"), C = new StringVertex("C");
    expected.transitionMatrix.put(A, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"a"}),B,null), null, A));
    expected.transitionMatrix.put(B, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"b"}),C,null), null, B));
    expected.transitionMatrix.put(C, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"c"}),A,null), null, C));
    expected.setInit(expected.findVertex("A"));
   
View Full Code Here

  public final void testGraphConstruction1b()
  {
    confString.setUseOrderedEntrySet(true);config.setUseOrderedEntrySet(true);
    LearnerGraph expected = new LearnerGraph(confString);expected.initEmpty();
    LearnerGraph graph = buildLearnerGraph("A--a-->B-b->C-c->A","testConstruction1",config,converter);
    CmpVertex A = new StringVertex("A"), B = new StringVertex("B"), C = new StringVertex("C");
    expected.transitionMatrix.put(A, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"a"}),B,null), null, A));
    expected.transitionMatrix.put(B, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"b"}),C,null), null, B));
    expected.transitionMatrix.put(C, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"c"}),A,null), null, C));
    expected.setInit(expected.findVertex("A"));
   
View Full Code Here

TOP

Related Classes of statechum.StringVertex

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.