# Path: LL1_Academy/models.py
# class Grammar(models.Model):
# 
# 	gid = models.AutoField(primary_key = True)
# 	prods = models.CharField(max_length=200)
# 	nonTerminals = models.CharField(max_length=4)
# 	terminals = models.CharField(max_length=4)
# 	startSymbol = models.CharField(max_length=1)
# 	nStart = models.IntegerField(default=0)
# 	nComplete = models.IntegerField(default=0)
# 	nSkip = models.IntegerField(default=0)
# 	
# 	def __str__(self):
# 		return str(self.gid) + ' ' + self.prods
# 
# class Question(models.Model):
# 
# 	QUESTION_TYPES = (
# 		('FI', 'first'),
# 		('FO','follow'),
# 		('LL','isLL1'),
# 		('PT','parseTable'),
# 	)
# 	gid = models.ForeignKey(Grammar, on_delete = models.CASCADE)
# 	qnum = models.IntegerField()
# 	category = models.CharField(max_length = 2, choices = QUESTION_TYPES)
# 	symbol = models.CharField(max_length = 1, blank = True)
# 	answer = models.CharField(max_length = 300)
# 	nCorrect = models.IntegerField(default=0)
# 	nWrong = models.IntegerField(default=0)
# 	nGiveUp = models.IntegerField(default=0)
# 
# 	def __str__(self):
# 		return str(self.gid.gid) + ' ' + str(self.qnum) + ' ' + self.category
# 
# 	class Meta:
# 		unique_together = (("gid","qnum"))
# 
# class UserHistory(models.Model):
# 	user = models.ForeignKey(User, on_delete = models.CASCADE)
# 	grammar = models.ForeignKey(Grammar, on_delete = models.CASCADE)
# 	complete = models.BooleanField(default=False)
# 	score = models.IntegerField(default=-1)
# 	updateTime = models.DateTimeField()
# 
# 	def __str__(self):
# 		return str(self.user) + ' ' + str(self.grammar.gid)
# 
# 	def save(self, *args, **kwargs):
# 	    if self.complete and self.score < 0:
# 	        raise Exception("Score cannot be blank for a completed question")
# 	    self.updateTime = timezone.now()
# 	    super(UserHistory, self).save(*args, **kwargs) 
# 
# 	class Meta:
# 		unique_together = (("user","grammar"))


from django.test import TestCase, Client
from django.http import HttpRequest
from django.urls import reverse
from LL1_Academy.models import Grammar, Question, UserHistory
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.conf import settings
from importlib import import_module
import LL1_Academy.views.practice as practice
import LL1_Academy.views.tutorial as tutorial
import LL1_Academy.views.views as views
import LL1_Academy.views.stats as stats
import LL1_Academy.views.userProfile as user_profile
import LL1_Academy.tools.GrammarChecker as grammar_checker
import LL1_Academy.tools.MassGrammarGenerator as mass_grammar_generator
import LL1_Academy.tools.SingleGrammarGenerator as single_grammar_generator
import LL1_Academy.tools.SvmLearn as svm_learn
# test case base class

# routing

# models

# sessions

# import the functions that we need to test

class TestData(TestCase):

    @classmethod
    def setUpTestData(cls):
        user = User.objects.create_user(username='test',
                                        email='test@gmail.com',
                                        password='test')

        g = Grammar(prods="{'A': ['xA', 'Bz'],'B': ['yB']}", nonTerminals="AB", terminals="xyz", startSymbol="A")
        g.save()


# Path: LL1_Academy/models.py
# class Grammar(models.Model):
# 
# 	gid = models.AutoField(primary_key = True)
# 	prods = models.CharField(max_length=200)
# 	nonTerminals = models.CharField(max_length=4)
# 	terminals = models.CharField(max_length=4)
# 	startSymbol = models.CharField(max_length=1)
# 	nStart = models.IntegerField(default=0)
# 	nComplete = models.IntegerField(default=0)
# 	nSkip = models.IntegerField(default=0)
# 	
# 	def __str__(self):
# 		return str(self.gid) + ' ' + self.prods
# 
# class Question(models.Model):
# 
# 	QUESTION_TYPES = (
# 		('FI', 'first'),
# 		('FO','follow'),
# 		('LL','isLL1'),
# 		('PT','parseTable'),
# 	)
# 	gid = models.ForeignKey(Grammar, on_delete = models.CASCADE)
# 	qnum = models.IntegerField()
# 	category = models.CharField(max_length = 2, choices = QUESTION_TYPES)
# 	symbol = models.CharField(max_length = 1, blank = True)
# 	answer = models.CharField(max_length = 300)
# 	nCorrect = models.IntegerField(default=0)
# 	nWrong = models.IntegerField(default=0)
# 	nGiveUp = models.IntegerField(default=0)
# 
# 	def __str__(self):
# 		return str(self.gid.gid) + ' ' + str(self.qnum) + ' ' + self.category
# 
# 	class Meta:
# 		unique_together = (("gid","qnum"))
# 
# class UserHistory(models.Model):
# 	user = models.ForeignKey(User, on_delete = models.CASCADE)
# 	grammar = models.ForeignKey(Grammar, on_delete = models.CASCADE)
# 	complete = models.BooleanField(default=False)
# 	score = models.IntegerField(default=-1)
# 	updateTime = models.DateTimeField()
# 
# 	def __str__(self):
# 		return str(self.user) + ' ' + str(self.grammar.gid)
# 
# 	def save(self, *args, **kwargs):
# 	    if self.complete and self.score < 0:
# 	        raise Exception("Score cannot be blank for a completed question")
# 	    self.updateTime = timezone.now()
# 	    super(UserHistory, self).save(*args, **kwargs) 
# 
# 	class Meta:
# 		unique_together = (("user","grammar"))


# Path: LL1_Academy/tests.py
from django.test import TestCase, Client
from django.http import HttpRequest
from django.urls import reverse
from LL1_Academy.models import Grammar, Question, UserHistory
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.conf import settings
from importlib import import_module
import LL1_Academy.views.practice as practice
import LL1_Academy.views.tutorial as tutorial
import LL1_Academy.views.views as views
import LL1_Academy.views.stats as stats
import LL1_Academy.views.userProfile as user_profile
import LL1_Academy.tools.GrammarChecker as grammar_checker
import LL1_Academy.tools.MassGrammarGenerator as mass_grammar_generator
import LL1_Academy.tools.SingleGrammarGenerator as single_grammar_generator
import LL1_Academy.tools.SvmLearn as svm_learn

# test case base class

# routing

# models

# sessions

# import the functions that we need to test

class TestData(TestCase):

    @classmethod
    def setUpTestData(cls):
        user = User.objects.create_user(username='test',
                                        email='test@gmail.com',
                                        password='test')

        g = Grammar(prods="{'A': ['xA', 'Bz'],'B': ['yB']}", nonTerminals="AB", terminals="xyz", startSymbol="A")
        g.save()


        q = Question(gid=g, qnum=0, category="FI", symbol="A", answer="xy")