how to know in which test case your code is not working

i coded sign wave problem and tested my code with various inputs and compared the outputs with the outputs generated by the previously submitted solutions and getting the desired results but don’t know here it is wrong when tested by codechef

Hello,

You can not know in which case your code did yout work, this is the one of the CodeChef rules, Yes… sometimes we want to know where is the problem, but it’s better to spend time searching for the bug (If you found your mistake, the next time you’ll not do it again :wink: ).

Good luck.

2 Likes

Hello @gurpreet2493, just generate random test cases… write a code for that and test your code against an 100 pts AC code using those test cases…

Have a look at code below(in PYTH 2.7) use ideone or codechef IDE to run if you do not have python installed in your system,

Code:

import random

#number of test cases = 50
T=50

def task1():
    print T
    for i in range(T):
        a=""
        s=random.randrange(0,12+1)
        c=random.randrange(0,12+1)
        k=random.randrange(1,25+1)
        a+=str(s)+" "+str(c)+" "+str(k)
        print a

def task2():
    print T
    for i in range(T):
        a=""
        s=random.randrange(0,50+1)
        c=0
        k=random.randrange(1,50+1)
        a+=str(s)+" "+str(c)+" "+str(k)
        print a

def task3():
    print T
    for i in range(T):
        a=""
        s=random.randrange(0,50+1)
        c=random.randrange(0,50+1)
        k=1
        a+=str(s)+" "+str(c)+" "+str(k)
        print a

def task4():
    print T
    for i in range(T):
        a=""
        s=random.randrange(0,50+1)
        c=random.randrange(0,50+1)
        k=random.randrange(1,100+1)
        a+=str(s)+" "+str(c)+" "+str(k)
        print a

def forTesting():
    print T
    for i in range(T):
        a=""
        s=random.randrange(0,10+1)
        c=random.randrange(0,10+1)
        k=random.randrange(1,10+1)
        a+=str(s)+" "+str(c)+" "+str(k)
        print a

forTesting()

here are few sample test cases, test your code against these cases

50
6 5 2
9 3 5
1 6 9
7 8 5
0 0 6
1 10 4
1 1 10
6 7 10
3 5 5
6 3 4
3 4 10
2 10 7
5 5 1
0 5 7
6 7 7
3 3 1
0 8 6
0 6 5
0 6 10
9 0 2
10 7 3
8 3 6
3 10 6
3 9 3
2 9 2
7 0 10
10 4 8
10 3 10
2 10 9
9 10 3
2 7 5
5 9 2
3 4 6
6 9 5
1 3 6
0 8 10
9 10 6
0 4 9
4 9 8
5 7 8
10 2 3
1 1 2
10 4 3
1 10 8
5 9 3
9 8 1
5 1 1
4 4 9
10 6 4
2 0 6

Enjoy Debugging… :slight_smile: