Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from QuestionToList import makeList | ||
print("Running Food finder tests") | ||
print("-"*50) | ||
try: | ||
from FoodFinder import findFood | ||
questions = ["Where can a man get himself a burger?", "I would like an icecream" , "I'm craving a lettuce at this time of the day", "How far is the nearest hospital?", "The closest atm", "A nice place to sleep"] | ||
answers = ["a burger", "an icecream", "a lettuce", "the nearest hospital", "the closest atm", "a nice place to sleep"] | ||
n = len(questions) | ||
count=0 | ||
for i in range(n): | ||
que = questions[i] | ||
ans = findFood(makeList(que)) | ||
if ans!=answers[i]: | ||
print("Food finder test for \"" + que + "\" failed") | ||
print("Expected: "+answers[i]) | ||
print("Got: "+ans) | ||
print("-"*50) | ||
count = count+1 | ||
print(str(n-count) + "/" + str(n) + " food finder tests passed") | ||
except ImportError: | ||
print("The function findFood was not present in the module FoodFinder") | ||
print("-"*50) | ||
print("End of Food finder tests") | ||
|
||
|