Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add execption for blank lines and lines with one word #35 #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions scripts/auto_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,27 @@ def auto_test(txt_file,ttf_file):
inputfile=open(txt_file)
outputfile=open("failed_test_case.txt","w")

#Read the test-case input
#Read the test-case input
flines=inputfile.readlines()
count=0

#Exceute hb-shape command for each test-case from output file
for string in flines:
words=string.split()
status, output = commands.getstatusoutput("hb-shape %s %s"%(ttf_file,words[0]))
# Test to check, wheather test-case from output file & the result, are matching
if words[1] != output:
print words[0]+ " [FAILURE]\n"
outputfile.write(" * "+words[0]+"\t"+""+output+"\n")
count=count+1

#Count for failed test-cases
#import pdb; pdb.set_trace()
words=string.split()
if words:
status, output = commands.getstatusoutput("hb-shape %s %s"%(ttf_file,words[0]))
# Test to check, wheather test-case from output file & the result, are matching
try:
if words[1] != output:
print words[0]+ " [FAILURE]"
outputfile.write(" * "+words[0]+"\t"+""+output+"\n")
count=count+1
except IndexError as err:
print words[0] + " [SKIPPED]"
outputfile.write("Skipped because line have only one word: %s\n" % words[0])

#Count for failed test-cases
print "%d Test Cases Failed out of %d"%(count,len(flines))
print "failed_test_case.txt file generated !!"
inputfile.close()
Expand Down