Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# Made by Andris Jansons
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")