Permalink
Cannot retrieve contributors at this time
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?
GroupD3/UnitTesting.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
26 lines (24 sloc)
1.06 KB
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
# 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") | |