feat: p0 and p1

This commit is contained in:
zsq259
2024-06-23 00:05:13 +08:00
parent f105d29e25
commit 71975d5889
228 changed files with 11213 additions and 0 deletions

View File

@ -0,0 +1 @@
order: "q1 q2 q3"

View File

@ -0,0 +1,2 @@
max_points: "1"
class: "PassAllTestsQuestion"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/addition1.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "2"

View File

@ -0,0 +1,7 @@
class: "EvalTest"
success: "add(a,b) returns the sum of a and b"
failure: "add(a,b) must return the sum of a and b"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "addition.add(1,1)"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/addition2.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "5"

View File

@ -0,0 +1,7 @@
class: "EvalTest"
success: "add(a,b) returns the sum of a and b"
failure: "add(a,b) must return the sum of a and b"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "addition.add(2,3)"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q1/addition3.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "7.9"

View File

@ -0,0 +1,7 @@
class: "EvalTest"
success: "add(a,b) returns the sum of a and b"
failure: "add(a,b) must return the sum of a and b"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "addition.add(10,-2.1)"

View File

@ -0,0 +1,2 @@
max_points: "1"
class: "PassAllTestsQuestion"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/food_price1.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "12.25"

View File

@ -0,0 +1,7 @@
class: "EvalTest"
success: "buyLotsOfFruit correctly computes the cost of the order"
failure: "buyLotsOfFruit must compute the correct cost of the order"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "buyLotsOfFruit.buyLotsOfFruit([ ('apples', 2.0), ('pears',3.0), ('limes',4.0) ])"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/food_price2.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "14.75"

View File

@ -0,0 +1,7 @@
class: "EvalTest"
success: "buyLotsOfFruit correctly computes the cost of the order"
failure: "buyLotsOfFruit must compute the correct cost of the order"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "buyLotsOfFruit.buyLotsOfFruit([ ('apples', 4.0), ('pears',3.0), ('limes',2.0) ])"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q2/food_price3.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "6.4375"

View File

@ -0,0 +1,7 @@
class: "EvalTest"
success: "buyLotsOfFruit correctly computes the cost of the order"
failure: "buyLotsOfFruit must compute the correct cost of the order"
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "buyLotsOfFruit.buyLotsOfFruit([ ('apples', 1.25), ('pears',1.50), ('limes',1.75) ])"

View File

@ -0,0 +1,2 @@
max_points: "1"
class: "PassAllTestsQuestion"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q3/select_shop1.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "<FruitShop: shop1>"

View File

@ -0,0 +1,21 @@
class: "EvalTest"
success: "shopSmart(order, shops) selects the cheapest shop"
failure: "shopSmart(order, shops) must select the cheapest shop"
# Python statements initializing variables for the test below.
preamble: """
import shop
dir1 = {'apples': 2.0, 'oranges':1.0}
shop1 = shop.FruitShop('shop1',dir1)
dir2 = {'apples': 1.0, 'oranges': 5.0}
shop2 = shop.FruitShop('shop2',dir2)
shops = [shop1, shop2]
order = [('apples',1.0), ('oranges',3.0)]
ans = shopSmart.shopSmart(order, shops)
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q3/select_shop2.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "<FruitShop: shop2>"

View File

@ -0,0 +1,21 @@
class: "EvalTest"
success: "shopSmart(order, shops) selects the cheapest shop"
failure: "shopSmart(order, shops) must select the cheapest shop"
# Python statements initializing variables for the test below.
preamble: """
import shop
dir1 = {'apples': 2.0, 'oranges':1.0}
shop1 = shop.FruitShop('shop1',dir1)
dir2 = {'apples': 1.0, 'oranges': 5.0}
shop2 = shop.FruitShop('shop2',dir2)
shops = [shop1, shop2]
order = [('apples',3.0)]
ans = shopSmart.shopSmart(order, shops)
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"

View File

@ -0,0 +1,3 @@
# This is the solution file for test_cases/q3/select_shop3.test.
# The result of evaluating the test must equal the below when cast to a string.
result: "<FruitShop: shop3>"

View File

@ -0,0 +1,23 @@
class: "EvalTest"
success: "shopSmart(order, shops) selects the cheapest shop"
failure: "shopSmart(order, shops) must select the cheapest shop"
# Python statements initializing variables for the test below.
preamble: """
import shop
dir1 = {'apples': 2.0, 'oranges':1.0}
shop1 = shop.FruitShop('shop1',dir1)
dir2 = {'apples': 1.0, 'oranges': 5.0}
shop2 = shop.FruitShop('shop2',dir2)
dir3 = {'apples': 1.5, 'oranges': 2.0}
shop3 = shop.FruitShop('shop3',dir3)
shops = [shop1, shop2, shop3]
order = [('apples',10.0), ('oranges',3.0)]
ans = shopSmart.shopSmart(order, shops)
"""
# A python expression to be evaluated. This expression must return the
# same result for the student and instructor's code.
test: "ans"