# Path: pydsl/grammar/definition.py
# class String(Grammar, str):
#     def __init__(self, string):
#         if isinstance(string, list):
#             raise TypeError('Attempted to initialize a String with a list %s' % (string, ) )
#         Grammar.__init__(self, None)
# 
#     @property
#     def first(self):
#         return String(self[0])
# 
#     def enum(self):
#         yield self
# 
#     @property
#     def maxsize(self):
#         return len(self)
# 
#     @property
#     def minsize(self):
#         return len(self)
# 
#     @property
#     def alphabet(self):
#         from pydsl.encoding import ascii_encoding
#         return ascii_encoding


import unittest
from pydsl.grammar.definition import String
        from pydsl.contrib.bnfgrammar import productionset0
        from pydsl.grammar.symbol import NonTerminalSymbol, TerminalSymbol
        from pydsl.grammar.PEG import Choice
        from pydsl.grammar.symbol import NonTerminalSymbol, EndSymbol
#pydsl is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with pydsl.  If not, see <http://www.gnu.org/licenses/>.



class TestBNF(unittest.TestCase):
    def setUp(self):
        self.grammardef = productionset0

    @unittest.skip("Not implemented")
    def testEnumerate(self):
        self.assertListEqual([x for x in self.grammardef.enum()], ["SR"])

    def testFirst(self):
        self.assertSetEqual(self.grammardef.first, set([String("S")]))

    @unittest.skip("Not implemented")
    def testMin(self):
        self.assertEqual(self.grammardef.minsize,2)

    @unittest.skip("Not implemented")
    def testMax(self):
        self.assertEqual(self.grammardef.maxsize,2)

    def testFirstLookup(self):

# Path: pydsl/grammar/definition.py
# class String(Grammar, str):
#     def __init__(self, string):
#         if isinstance(string, list):
#             raise TypeError('Attempted to initialize a String with a list %s' % (string, ) )
#         Grammar.__init__(self, None)
# 
#     @property
#     def first(self):
#         return String(self[0])
# 
#     def enum(self):
#         yield self
# 
#     @property
#     def maxsize(self):
#         return len(self)
# 
#     @property
#     def minsize(self):
#         return len(self)
# 
#     @property
#     def alphabet(self):
#         from pydsl.encoding import ascii_encoding
#         return ascii_encoding


# Path: tests/unit/test_BNF.py
import unittest
from pydsl.grammar.definition import String
        from pydsl.contrib.bnfgrammar import productionset0
        from pydsl.grammar.symbol import NonTerminalSymbol, TerminalSymbol
        from pydsl.grammar.PEG import Choice
        from pydsl.grammar.symbol import NonTerminalSymbol, EndSymbol

#pydsl is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with pydsl.  If not, see <http://www.gnu.org/licenses/>.



class TestBNF(unittest.TestCase):
    def setUp(self):
        self.grammardef = productionset0

    @unittest.skip("Not implemented")
    def testEnumerate(self):
        self.assertListEqual([x for x in self.grammardef.enum()], ["SR"])

    def testFirst(self):
        self.assertSetEqual(self.grammardef.first, set([String("S")]))

    @unittest.skip("Not implemented")
    def testMin(self):
        self.assertEqual(self.grammardef.minsize,2)

    @unittest.skip("Not implemented")
    def testMax(self):
        self.assertEqual(self.grammardef.maxsize,2)

    def testFirstLookup(self):

        self.assertEqual(self.grammardef.first_lookup(NonTerminalSymbol("exp")),Choice([String("S")]))