示例#1
0
  def testSingleNode(self):
    """Tests a single node is expanded to a list with the label string."""

    # 'ab' -> [ 'ab' ]

    node1 = ( 'ab', [ None ] )
    words = [ 'ab' ]
    self.assertEqual(make_dafsa.to_words(node1), words)
示例#2
0
  def testSingleNode(self):
    """Tests a single node is expanded to a list with the label string."""

    # 'ab' -> [ 'ab' ]

    node1 = ( 'ab', [ None ] )
    words = [ 'ab' ]
    self.assertEqual(make_dafsa.to_words(node1), words)
示例#3
0
  def testChain(self):
    """Tests a sequence of nodes are preoperly expanded."""

    # 'ab' -> 'cd' => [ 'abcd' ]

    node2 = ( 'cd', [ None ] )
    node1 = ( 'ab', [ node2 ] )
    words = [ 'abcd' ]
    self.assertEqual(make_dafsa.to_words(node1), words)
示例#4
0
  def testChain(self):
    """Tests a sequence of nodes are preoperly expanded."""

    # 'ab' -> 'cd' => [ 'abcd' ]

    node2 = ( 'cd', [ None ] )
    node1 = ( 'ab', [ node2 ] )
    words = [ 'abcd' ]
    self.assertEqual(make_dafsa.to_words(node1), words)
示例#5
0
  def testInnerTerminator(self):
    """Tests a sequence with an inner terminator is expanded to two strings."""

    # 'a' -> 'b'
    #   \       => [ 'ab', 'a' ]
    #  {sink}

    node2 = ( 'b', [ None ] )
    node1 = ( 'a', [ node2, None ] )
    words = [ 'ab', 'a' ]
    self.assertEqual(make_dafsa.to_words(node1), words)
示例#6
0
  def testInnerTerminator(self):
    """Tests a sequence with an inner terminator is expanded to two strings."""

    # 'a' -> 'b'
    #   \       => [ 'ab', 'a' ]
    #  {sink}

    node2 = ( 'b', [ None ] )
    node1 = ( 'a', [ node2, None ] )
    words = [ 'ab', 'a' ]
    self.assertEqual(make_dafsa.to_words(node1), words)
示例#7
0
  def testDiamond(self):
    """Tests a diamond can be expanded to a word list."""

    #   'cd'
    #   /  \
    # 'ab' 'gh'
    #   \  /
    #   'ef'

    node4 = ( 'gh', [ None ] )
    node3 = ( 'ef', [ node4 ] )
    node2 = ( 'cd', [ node4 ] )
    node1 = ( 'ab', [ node2, node3 ] )
    words = [ 'abcdgh', 'abefgh' ]
    self.assertEqual(make_dafsa.to_words(node1), words)
示例#8
0
  def testDiamond(self):
    """Tests a diamond can be expanded to a word list."""

    #   'cd'
    #   /  \
    # 'ab' 'gh'
    #   \  /
    #   'ef'

    node4 = ( 'gh', [ None ] )
    node3 = ( 'ef', [ node4 ] )
    node2 = ( 'cd', [ node4 ] )
    node1 = ( 'ab', [ node2, node3 ] )
    words = [ 'abcdgh', 'abefgh' ]
    self.assertEqual(make_dafsa.to_words(node1), words)
示例#9
0
 def testSink(self):
   """Tests the sink is exapnded to a list with an empty string."""
   node1 = None
   words = [ '' ]
   self.assertEqual(make_dafsa.to_words(node1), words)
示例#10
0
 def testSink(self):
   """Tests the sink is exapnded to a list with an empty string."""
   node1 = None
   words = [ '' ]
   self.assertEqual(make_dafsa.to_words(node1), words)