예제 #1
0
 def test_output(self,m):
     
     dct = []
     self.ans = main()
     for value in self.ans:
         dct.append(value)
     self.assertEqual("yes",dct[0])
     self.assertEqual("no",dct[1])
     self.assertEqual("fail",dct[2])
예제 #2
0
 def test(self):
     try:
         if params == 0:
             result = main(*a)
             self.assertEqual(result,result)
         elif params > 0:
             test = []
             for i in range(0,params):
                 test.append(a[i])
             result = wrapper(main,a)
             self.assertEquals(result,result)
     except:
         self.fail("Raised an exception")
예제 #3
0
파일: output.py 프로젝트: thuydt55/ktpm2013
    def test(self):
        try:
            if (params == 0):
                result = main()
                self.assertEquals(result, result)

            elif (params > 0):
                a = []
                for i in range(0, params):
                    a.append(p[i])
                result = wrapper(main, a)
                self.assertEquals(result, result)
        except:
            self.fail("Raised an exception.")
예제 #4
0
파일: output.py 프로젝트: thuydt55/ktpm2013
    def test(self):
        try:
            if (params == 0):
                result = main()
                self.assertEquals(result,result)

            elif (params > 0):
                a = []
                for i in range(0,params):
                    a.append(p[i])
                result = wrapper(main, a)
                self.assertEquals(result,result)
        except:
            self.fail("Raised an exception.")
예제 #5
0
 def test(self):
     self.assertEqual("pass", main(*a))
예제 #6
0
            raise Exception("wrong input")
        if len(array1[i]) > 4 and (array1[i][4] - array1[i][1]) * (
                array1[i][5] - array1[i][0]) < 0:
            raise Exception("wrong input")


class TestGeneration(unittest.TestCase):
    pass


def test_generator(a, b):
    def test(self):
        self.assertEqual(a, b)

    return test


if __name__ == '__main__':
    print "\nMang gia tri : "
    print array1

    print "\nMang cac test case : "
    print array2

    for i in itertools.product(*array2):
        print i
        test_name = 'test_%s' % str(i)
        test = test_generator(input.main(*i), 1)
        setattr(TestGeneration, test_name, test)
    unittest.main()
예제 #7
0
for k in range(len(numberOfEquiv)):
    values.insert(k, sum(numberOfEquiv[0:(k+1)]))
    
listTest.append(listValues[0:values[0]])
for h in range(len(numberOfEquiv)-1):
    listTest.insert(h, listValues[values[h]:values[h+1]])
    
listTest1 = list(itertools.product(*listTest))

# ********************************************

class TestSequence(unittest.TestCase):
    pass

def test_generation(a,b):
    def test(self):
        self.assertEqual(a,b)
    return test

l=0
if __name__ == '__main__':
        for t in listTest1:
            test_name = 'test'+str(l)
            test = test_generation(main(*t),"Not a triangle")
            setattr(TestSequence, test_name, test)
            l = l+1
        unittest.main()
         


예제 #8
0
 def test(self):
     self.assertEqual(main(*a),b)
예제 #9
0
파일: output.py 프로젝트: thylm55/ktpm2013
 def test(self):
     if (paramsLen == 0):
         result = main()
     if (paramsLen == 1):
         result = main(params[0])
     if (paramsLen == 2):
         result = main(params[0], params[1])
     if (paramsLen == 3):
         result = main(params[0], params[1], params[2])
     if (paramsLen == 4):
         result = main(params[0], params[1], params[2], params[3])
     if (paramsLen == 5):
         result = main(params[0], params[1], params[2], params[3],
                       params[4])
     if (paramsLen == 6):
         result = main(params[0], params[1], params[2], params[3],
                       params[4], params[5])
     if (paramsLen == 7):
         result = main(params[0], params[1], params[2], params[3],
                       params[4], params[5], params[6])
     if (paramsLen == 8):
         result = main(params[0], params[1], params[2], params[3],
                       params[4], params[5], params[6], params[7])
     if (paramsLen == 9):
         result = main(params[0], params[1], params[2], params[3],
                       params[4], params[5], params[6], params[7],
                       params[8])
     if (paramsLen == 10):
         result = main(params[0], params[1], params[2], params[3],
                       params[4], params[5], params[6], params[7],
                       params[8], params[9])
     self.assertEqual(result, "")
예제 #10
0
for i in range(0,len(ListPerLine)):
    l1 = []
    l2 = []
    for j in range(0,len(ListPerLine[i]),2):
        l1.append(int(ListPerLine[i][j]))
        l2.append(int(ListPerLine[i][j+1]))
    #print l1
    sortList(l1,l2)
    left.append(l1)
    right.append(l2)
print left
print right
listValue = randomList(left, right)
class TestSequense(unittest.TestCase):
    pass
def test_generator(a,b):
    def test(self):
        self.assertEqual(a,b)
    return test
if __name__ == '__main__':
    if (checkCondition(left, right) == 0):
        raise Exception("wrong input")
    else:
        m = 0;
        for i in itertools.product(*listValue):
            test_name = 'test_%d' %m
            m = m+1
            test = test_generator(main(*i),"abc")
            setattr(TestSequense,test_name,test)
        unittest.main()
예제 #11
0
 def test(self):
     self.assertEqual("pass" , main(*a))
예제 #12
0
 def test(self):
     self.assertEqual(input.main(*x), '', '')
예제 #13
0
import inspect

curr_file = inspect.getfile(inspect.currentframe())
sys.path.append(os.getcwd() + "/" + os.path.dirname(curr_file))

import input


def main():

    test = struct.unpack("!d", binascii.unhexlify("C040000000000000"))[0]
    print test

    print trick.command_line_args_get_default_dir()
    print trick.get_trick_env("TRICK_CFLAGS")


if __name__ == "__main__":
    input.main()
    main()
예제 #14
0
                b.append(d)
    return b'''

#Tao test cases
def testCase(docs):
    bigArray=[]
    i = 0
    for line in docs:
        bigArray.append(normalization(line))
        i = i+1
    a = list(itertools.product(*bigArray))
    return a

class Test(unittest.TestCase):
    pass

def test_generator(a,b):
    def test(self):
        self.assertEqual(a,b)
    return test

result = testCase(docs)

i=0
if __name__ == '__main__':
    for t in result:
        test_name = 'testName'+str(i)
        test = test_generator(main(*t),"tam giac deu")
        setattr(Test, test_name, test)
        i = i+1
    unittest.main()
예제 #15
0
 def test(self):
     self.assertEqual(input.main(*parameter), '')
예제 #16
0
파일: test.py 프로젝트: Arafatk/trick
import inspect

curr_file = inspect.getfile(inspect.currentframe())
sys.path.append(os.getcwd() + "/" + os.path.dirname(curr_file))

import input

def main():

    test = struct.unpack("!d", binascii.unhexlify("C040000000000000"))[0]
    print test

    print trick.command_line_args_get_default_dir()
    print trick.get_trick_env("TRICK_CFLAGS")

if __name__ == "__main__":
    input.main()
    main()

예제 #17
0
            lst.insert(funcArgs.index(varInfor.varName), varInfor)
    return InputInformation(lst)


# doc = input.main.__doc__
# info = initInputInforFromDoc(doc, input.main)
# print info.getListTestCase()


class MyTest(unittest.TestCase):
    pass


def test_generator(a, b):
    def test(self):
        self.assertEqual(a, b)

    return test


if __name__ == '__main__':
    doc = input.main.__doc__
    inputInfor = initInputInforFromDoc(doc, input.main)
    testCases = inputInfor.getListTestCase()
    i = 0
    for t in testCases:
        test_name = 'test_%d' % i
        i = i + 1
        test = test_generator(input.main(*t), "")
        setattr(MyTest, test_name, test)
    unittest.main()
예제 #18
0

class TestSequense(unittest.TestCase):
    pass


def test_generator(a, b):
    def test(self):
        self.assertEqual(a, b)

    return test


'''Main function:'''
if __name__ == "__main__":

    input_data = getInputContent()

    try:
        a = list(itertools.product(*input_data))
        i = 0
        for t in a:
            i = i + 1
            test_name = 'test_%s' % i
            test = test_generator(input.main(*t), input.main(*t))
            setattr(TestSequense, test_name, test)

        unittest.main()
    except Exception:
        raise Exception("wrong input")
예제 #19
0
#Ngoai le:


for i in range (0, len(array) ):
        for j in range(0, len(array[i])-2,2):
            if (array[i][j+2]-array[i][j+1])*(array[i][j+3]-array[i][j]) < 0:
                raise Exception("wrong input")
            if len(array[i]) > 4 and ( array[i][4]-array[i][1])*(array[i][5]-array[i][0]) < 0 :
                raise Exception("wrong input")
                      
#Test
            
print "\nMang Test case : "
print arr          

class TestSequense(unittest.TestCase):
    pass

def test_generator(a, b):
    def test(self):
        self.assertEqual(a,b)
    return test

if __name__ == '__main__':
    print "\nCac test case : "
    for element in itertools.product(*arr):
        print element
        test_name = 'test_%s' %str(element)
        test = test_generator(input.main(*element) , "gia tri tra ve")
        setattr(TestSequense, test_name, test)
    unittest.main()
예제 #20
0
 def test(self):
     self.assertAlmostEqual(0,main(*a))
예제 #21
0
파일: output.py 프로젝트: linhlv55/ktpm2013
 def test(self):
     self.assertEqual(main(a),"test")
예제 #22
0
파일: output.py 프로젝트: tript55/kttm2013
                                ne[k + 1]):
                            raise Exception("wrong input")
                        l = l + 2
                    x = randint(int(ne[k]), int(ne[k + 1]))
                    selectednums.append(x)
                    k = k + 2
                lval.append(selectednums)
    return lval


class TestSequense(unittest.TestCase):
    pass


def test_generator(a, b):
    def test(self):
        self.assertEqual(a, b)

    return test


if __name__ == '__main__':
    m = 0
    b = "socio"
    lval = importfile("input.py")
    for i in itertools.product(*lval):
        test_name = 'test_%d' % m
        m = m + 1
        test = test_generator(main(*i), b)
        setattr(TestSequense, test_name, test)
    unittest.main()
예제 #23
0
 def test(self):
     self.assertEqual(input.main(*args), "Hello world!")
예제 #24
0
        numbOfNode.append(min-1)

        listNumb.append(numbOfNode)

    ##### Tao cac testcase #####
    testList=[]
    for i in product(*listNumb):
        testList.append(i)
    return testList
    

######################################################################
    
class Tests(unittest.TestCase):
    pass

def test_generator(a, b):
    def test(self):
        self.assertEqual(a,b)
    return test

if __name__ == '__main__':
    result = createTest()
    dem=0
    for i in result:
        test_name = 'test_%s' % dem
        dem=dem+1
        setattr(Tests, test_name, test_generator(input.main(*i), ''))

    unittest.main()
예제 #25
0
for i in range (0, len(array1) ):
        for j in range(0, len(array1[i])-2,2):
            if (array1[i][j+2]-array1[i][j+1])*(array1[i][j+3]-array1[i][j]) < 0:
                raise Exception("wrong input")
            if len(array1[i]) > 4 and ( array1[i][4]-array1[i][1])*(array1[i][5]-array1[i][0]) < 0 :
                raise Exception("wrong input")

class TestGeneration(unittest.TestCase):
    pass

def test_generator(a, b):
    def test(self):
        self.assertEqual(a,b)
    return test

if __name__ == '__main__':
    print "\nMang gia tri : "
    print array1

    print "\nMang cac test case : "
    print array2

    for i in itertools.product(*array2):
        print i
        test_name = 'test_%s' %str(i)
        test = test_generator(input.main(*i) , 1)
        setattr(TestGeneration, test_name, test)
    unittest.main()

예제 #26
0
                    temp.append(j)
                t = t + 1
            valueList.append(temp)
    return valueList

def createTest():
    List = createEvalue()
    next_list = list(product(*List))
    return next_list

def test_generator(a, b):
    def test(self):
        self.assertEqual(a,b)
    return test

if __name__ == '__main__':

    param_list = createTest()
    check = checkList()
    
    if check == 1:
        for t in param_list:
            test_name = 'test_%s' % param_list.index(t)
            result = main(*t)
            test = test_generator(result, "")
            setattr(TestSequense, test_name, test)
    else:
        raise Exception("wrong input")
    unittest.main()
    
예제 #27
0
 def test(self):
     self.assertEqual(main(*args),1)
예제 #28
0
			def test(self):
				"""
					call assertEqual 
				"""
				self.assertEqual(input.main(*parameter),'2')
예제 #29
0
 def test(self):
     self.assertEqual(input.main(*args), 0)
예제 #30
0
파일: output.py 프로젝트: tript55/kttm2013
                selectednums = []
                
                while (k < len(ne)):
                    if int(ne[k]) > int(ne[k+1]):
                        raise Exception("wrong input")
                    l = k +2
                    while (l < len(ne)):
                        if int(ne[k]) <= int(ne[l+1]) and int(ne[l]) <= int(ne[k+1]):
                            raise Exception("wrong input")
                        l = l+2
                    x = randint(int(ne[k]),int(ne[k+1]))
                    selectednums.append(x)
                    k = k+2
                lval.append(selectednums)
    return lval
class TestSequense(unittest.TestCase):
    pass
def test_generator(a,b):
    def test(self):
        self.assertEqual(a,b)
    return test
if __name__ == '__main__':
    m = 0;
    b ="socio"
    lval = importfile("input.py")
    for i in itertools.product(*lval):
        test_name = 'test_%d' %m
        m = m+1
        test = test_generator(main(*i),b)
        setattr(TestSequense,test_name,test)
    unittest.main()
예제 #31
0
 def test(self):
     x = main(*a)
     self.assertEqual(main(*a), x)
예제 #32
0
파일: output.py 프로젝트: thylm55/ktpm2013
 def test(self):
     if (paramsLen == 0):
         result = main()
     if (paramsLen == 1):
         result = main(params[0])
     if (paramsLen == 2):
         result = main(params[0], params[1])
     if (paramsLen == 3):
         result = main(params[0], params[1]
                 , params[2])
     if (paramsLen == 4):
         result = main(params[0], params[1]
                 , params[2], params[3])
     if (paramsLen == 5):
         result = main(params[0], params[1]
                 , params[2], params[3]
                 , params[4])
     if (paramsLen == 6):
         result = main(params[0], params[1]
                 , params[2], params[3]
                 , params[4], params[5])
     if (paramsLen == 7):
         result = main(params[0], params[1]
                  , params[2], params[3]
                  , params[4], params[5]
                  , params[6])
     if (paramsLen == 8):
         result = main(params[0], params[1]
                  , params[2], params[3]
                  , params[4], params[5]
                  , params[6], params[7])
     if (paramsLen == 9):
         result = main(params[0], params[1]
                  , params[2], params[3]
                  , params[4], params[5]
                  , params[6], params[7]
                  , params[8])
     if (paramsLen == 10):
         result = main(params[0], params[1]
                  , params[2], params[3]
                  , params[4], params[5]
                  , params[6], params[7]
                  , params[8], params[9])
     self.assertEqual(result, "")
예제 #33
0
    values.insert(k, sum(numberOfEquiv[0:(k + 1)]))

listTest.append(listValues[0:values[0]])
for h in range(len(numberOfEquiv) - 1):
    listTest.insert(h, listValues[values[h]:values[h + 1]])

listTest1 = list(itertools.product(*listTest))

# ********************************************


class TestSequence(unittest.TestCase):
    pass


def test_generation(a, b):
    def test(self):
        self.assertEqual(a, b)

    return test


l = 0
if __name__ == '__main__':
    for t in listTest1:
        test_name = 'test' + str(l)
        test = test_generation(main(*t), "Not a triangle")
        setattr(TestSequence, test_name, test)
        l = l + 1
    unittest.main()
예제 #34
0
    bigArray = []
    i = 0
    for line in docs:
        bigArray.append(normalization(line))
        i = i + 1
    a = list(itertools.product(*bigArray))
    return a


class Test(unittest.TestCase):
    pass


def test_generator(a, b):
    def test(self):
        self.assertEqual(a, b)

    return test


result = testCase(docs)

i = 0
if __name__ == '__main__':
    for t in result:
        test_name = 'testName' + str(i)
        test = test_generator(main(*t), "tam giac deu")
        setattr(Test, test_name, test)
        i = i + 1
    unittest.main()
예제 #35
0
    endList = [[]]
    for i in range(0,len(stringList)):
        array = getArrayFromString(stringList[i])
        if i == 0:
            endList[0].append(array[0])
            for j in range(1,len(array)):
                endList.append([])
                endList[j].append(array[j])
            
        else:
            
            endList = copy.deepcopy(concat(endList,array))        
    return endList    
class TestSequense(unittest.TestCase):
    pass
def test_generator(a, b):
    def test(self):
        self.assertEqual(a,b)
    return test
endList = process()
if __name__ == '__main__':
            for t in endList:
                test_name = 'test_%s' % t
                test = test_generator(main(*t), "")
                setattr(TestSequense, test_name, test)
            unittest.main()
    
    
    
    
예제 #36
0
 def Test(self):
     return self.assertEqual("Test", input.main(*args), 1)
예제 #37
0
파일: output.py 프로젝트: datpa55/KTPM2013
 def test(self):
     self.assertEqual(main(*arr), 'x')
예제 #38
0
파일: output.py 프로젝트: linhdt55/ktpm2013
	def test(self):
		self.assertEqual(input.main(*parameter),'')
예제 #39
0
파일: output.py 프로젝트: banghk/KTPM2013

# Xu ly ngoai le
# Neu ngoai le xay ra se in ra thong bao "wrong input"
for n in range (0, len(A2) ):
        for i in range(0, len(A2[n])-2,2):
            if (A2[n][i+3]-A2[n][i])*(A2[n][i+2]-A2[n][i+1]) < 0:
                raise Exception("wrong input")
            
            if len(A2[n]) > 4 and ( A2[n][4]-A2[n][1])*(A2[n][5]-A2[n][0]) < 0 :
                raise Exception("wrong input")
                      
# Lop unittest      
class TestSequense(unittest.TestCase):
    pass

def test_generator(a, b):
    def test(self):
        self.assertEqual(a,b)
    return test

# Chuc nang chinh
if __name__ == '__main__':
    print "\nTest case : "
    for e in itertools.product(*A1):
        print e
        test_name = 'test_%s' %str(e)
        test = test_generator(input.main(*e) , "gia tri tra ve")
        setattr(TestSequense, test_name, test)
    unittest.main()
예제 #40
0
파일: output.py 프로젝트: ketnh/KTPM_2013
 def test(self):
     self.assertEqual(input.main(*x),'','')
예제 #41
0
 def test(self):
     self.assertAlmostEqual(0, main(*a))
예제 #42
0
    funcArgs = inspect.getargspec(func)[0]
    lst = []    
    for line in lines:
        if line.strip() <> '':
            varInfor = parseString(line.strip())            
            lst.insert(funcArgs.index(varInfor.varName), varInfor)        
    return InputInformation(lst)

# doc = input.main.__doc__
# info = initInputInforFromDoc(doc, input.main)
# print info.getListTestCase()

class MyTest(unittest.TestCase):
    pass
 
def test_generator(a, b):
    def test(self):
        self.assertEqual(a, b) 
    return test
 
if __name__ == '__main__':
    doc = input.main.__doc__
    inputInfor = initInputInforFromDoc(doc, input.main)
    testCases = inputInfor.getListTestCase()    
    i = 0
    for t in testCases:        
        test_name = 'test_%d' % i
        i = i+1       
        test = test_generator(input.main(*t), "")        
        setattr(MyTest, test_name, test)
    unittest.main()
예제 #43
0
파일: output.py 프로젝트: anhnt55/ktpm2013
 def test(self):
     self.assertEqual(input.main(*args),"Hello world!")
예제 #44
0
파일: output.py 프로젝트: vuqt55/ktpm2013
        def test(self):
		x = main(*a)
                self.assertEqual(main(*a),x);
예제 #45
0
 def test(self):
     self.assertEqual(input.main(*a), 1) 
예제 #46
0
파일: output.py 프로젝트: toannd55/ktpm2013
 def test(self):
     self.assertEqual(input.main(*args),0)
예제 #47
0
 def test(self):
     self.assertEqual(main(*a),b)
예제 #48
0
파일: output.py 프로젝트: linhlv55/ktpm2013
 def test(self):
     self.assertEqual(main(a), "test")