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

[concept-exercises-test-upgrades]: Updated tests in the concept exercises using not deprecated functionality. #143

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions exercises/concept/lasagna/.meta/testAnnotation.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[
{
"name": "lasagna.test.ex1",
"test_code": "let\n Test.expect (expectedMinutesInOven === 40)"
"name": "expected minutes in oven",
"test_code": "verify do\n labeled \"expected minutes in oven\" do\n expected = 40\n label \"expected\" expected\n label \"actual\" expectedMinutesInOven\n ensureEqual expected expectedMinutesInOven"
},
{
"name": "lasagna.test.ex2",
"test_code": "let\n Test.expect (preparationTimeInMinutes 5 === 10)"
"name": "preparation time in minutes",
"test_code": "verify do\n labeled \"preparation time in minutes\" do\n expected = 10\n actual = preparationTimeInMinutes 5\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "lasagna.test.ex3",
"test_code": "let\n Test.expect (elapsedTimeInMinutes 3 20 === 26)"
"name": "elapsed time in minutes",
"test_code": "verify do\n labeled \"elapsed time in minutes\" do\n expected = 26\n actual = elapsedTimeInMinutes 3 20\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
}
]
]
28 changes: 21 additions & 7 deletions exercises/concept/lasagna/lasagna.test.u
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
lasagna.test.ex1 = let
Test.expect (expectedMinutesInOven === 40)
lasagna.test.ex1 = verify do
labeled "expected minutes in oven" do
expected = 40
label "expected" expected
label "actual" expectedMinutesInOven
ensureEqual expected expectedMinutesInOven

lasagna.test.ex2 = let
Test.expect (preparationTimeInMinutes 5 === 10)
lasagna.test.ex2 = verify do
labeled "preparation time in minutes" do
expected = 10
actual = preparationTimeInMinutes 5
label "expected" expected
label "actual" actual
ensureEqual expected actual

lasagna.test.ex3 = let
Test.expect (elapsedTimeInMinutes 3 20 === 26)
lasagna.test.ex3 = verify do
labeled "elapsed time in minutes" do
expected = 26
actual = elapsedTimeInMinutes 3 20
label "expected" expected
label "actual" actual
ensureEqual expected actual

test> lasagna.tests = runAll [
test> lasagna.tests = join [
lasagna.test.ex1,
lasagna.test.ex2,
lasagna.test.ex3
Expand Down
24 changes: 12 additions & 12 deletions exercises/concept/pacman-rules/.meta/testAnnotation.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
[
{
"name": "eatGhost, ghost gets eaten",
"test_code": "let\n Test.label.deprecated \"eatGhost, ghost gets eaten\" <| expect (eatGhost true true)"
"test_code": "verify do\n labeled \"eatGhost, ghost gets eaten\" do\n expected = true\n actual = eatGhost true true\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "eatGhost, ghost does not get eaten because no power pellet active",
"test_code": "let\n Test.label.deprecated \"eatGhost, ghost does not get eaten because no power pellet active\" <| expect (eatGhost false true === false)"
"test_code": "verify do\n labeled \"eatGhost, ghost does not get eaten because no power pellet active\" do\n expected = false\n actual = eatGhost false true\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "eatGhost, ghost does not get eaten because not touching ghost",
"test_code": "let\n Test.label.deprecated \"eatGhost, ghost does not get eaten because not touching ghost\" <| expect (eatGhost true false === false)"
"test_code": "verify do\n labeled \"eatGhost, ghost does not get eaten because not touching ghost\" do\n expected = false\n actual = eatGhost true false\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "score, score when eating dot",
"test_code": "let\n Test.label.deprecated \"score, score when eating dot\" <| expect (score false true)"
"test_code": "verify do\n labeled \"score, score when eating dot\" do\n expected = true\n actual = score false true\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "score, score when eating power pellet",
"test_code": "let\n Test.label.deprecated \"score, score when eating power pellet\" <| expect (score true false)"
"test_code": "verify do\n labeled \"score, score when eating power pellet\" do\n expected = true\n actual = score true false\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "score, no score when nothing eaten",
"test_code": "let\n Test.label.deprecated \"score, no score when nothing eaten\" <| expect (score false false === false )"
"test_code": "verify do\n labeled \"score, no score when nothing eaten\" do\n expected = false\n actual = score false false\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "lose if touching a ghost without a power pellet active",
"test_code": "let\n Test.label.deprecated \"lose if touching a ghost without a power pellet active\" <| expect (lose false true)"
"test_code": "verify do\n labeled \"lose if touching a ghost without a power pellet active\" do\n expected = true\n actual = lose false true\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "don't lose if touching a ghost with a power pellet active",
"test_code": "let\n Test.label.deprecated \"don't lose if touching a ghost with a power pellet active\" <| expect (lose true true === false)"
"test_code": "verify do\n labeled \"don't lose if touching a ghost with a power pellet active\" do\n expected = false\n actual = lose true true\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "don't lose if not touching a ghost",
"test_code": "let\n Test.label.deprecated \"don't lose if not touching a ghost\" <| expect (lose true false === false)"
"test_code": "verify do\n labeled \"don't lose if not touching a ghost\" do\n expected = false\n actual = lose true false\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "win if all dots eaten",
"test_code": "let\n Test.label.deprecated \"win if all dots eaten\" <| expect (win true false false)"
"test_code": "verify do\n labeled \"win if all dots eaten\" do\n expected = true\n actual = win true false false\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "don't win if all dots eaten, but touching a ghost",
"test_code": "let\n Test.label.deprecated \"don't win if all dots eaten, but touching a ghost\" <| expect (win true false true === false)"
"test_code": "verify do\n labeled \"don't win if all dots eaten, but touching a ghost\" do\n expected = false\n actual = win true false true\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
},
{
"name": "win if all dots eaten and touching a ghost with a power pellet active",
"test_code": "let\n Test.label.deprecated \"win if all dots eaten and touching a ghost with a power pellet active\" <| expect (win true true true)"
"test_code": "verify do\n labeled \"win if all dots eaten and touching a ghost with a power pellet active\" do\n expected = true\n actual = win true true true\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual"
}
]
110 changes: 85 additions & 25 deletions exercises/concept/pacman-rules/pacmanRules.test.u
Original file line number Diff line number Diff line change
@@ -1,40 +1,100 @@
pacmanRules.test.ex1 = let
Test.label.deprecated "eatGhost, ghost gets eaten" <| expect (eatGhost true true)
pacmanRules.test.ex1 = verify do
labeled "eatGhost, ghost gets eaten" do
expected = true
actual = eatGhost true true
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex2 = let
Test.label.deprecated "eatGhost, ghost does not get eaten because no power pellet active" <| expect (eatGhost false true === false)
pacmanRules.test.ex2 = verify do
labeled "eatGhost, ghost does not get eaten because no power pellet active" do
expected = false
actual = eatGhost false true
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex3 = let
Test.label.deprecated "eatGhost, ghost does not get eaten because not touching ghost" <| expect (eatGhost true false === false)
pacmanRules.test.ex3 = verify do
labeled "eatGhost, ghost does not get eaten because not touching ghost" do
expected = false
actual = eatGhost true false
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex4 = let
Test.label.deprecated "score, score when eating dot" <| expect (score false true)
pacmanRules.test.ex4 = verify do
labeled "score, score when eating dot" do
expected = true
actual = score false true
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex5 = let
Test.label.deprecated "score, score when eating power pellet" <| expect (score true false)
pacmanRules.test.ex5 = verify do
labeled "score, score when eating power pellet" do
expected = true
actual = score true false
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex6 = let
Test.label.deprecated "score, no score when nothing eaten" <| expect (score false false === false )
pacmanRules.test.ex6 = verify do
labeled "score, no score when nothing eaten" do
expected = false
actual = score false false
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex7 = let
Test.label.deprecated "lose if touching a ghost without a power pellet active" <| expect (lose false true)
pacmanRules.test.ex7 = verify do
labeled "lose if touching a ghost without a power pellet active" do
expected = true
actual = lose false true
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex8 = let
Test.label.deprecated "don't lose if touching a ghost with a power pellet active" <| expect (lose true true === false)
pacmanRules.test.ex8 = verify do
labeled "don't lose if touching a ghost with a power pellet active" do
expected = false
actual = lose true true
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex9 = let
Test.label.deprecated "don't lose if not touching a ghost" <| expect (lose true false === false)
pacmanRules.test.ex9 = verify do
labeled "don't lose if not touching a ghost" do
expected = false
actual = lose true false
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex10 = let
Test.label.deprecated "win if all dots eaten" <| expect (win true false false)
pacmanRules.test.ex10 = verify do
labeled "win if all dots eaten" do
expected = true
actual = win true false false
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex11 = let
Test.label.deprecated "don't win if all dots eaten, but touching a ghost" <| expect (win true false true === false)
pacmanRules.test.ex11 = verify do
labeled "don't win if all dots eaten, but touching a ghost" do
expected = false
actual = win true false true
label "expected" expected
label "actual" actual
ensureEqual expected actual

pacmanRules.test.ex12 = let
Test.label.deprecated "win if all dots eaten and touching a ghost with a power pellet active" <| expect (win true true true)
pacmanRules.test.ex12 = verify do
labeled "win if all dots eaten and touching a ghost with a power pellet active" do
expected = true
actual = win true true true
label "expected" expected
label "actual" actual
ensureEqual expected actual

test> pacmanRules.tests = runAll [
test> pacmanRules.tests = join [
pacmanRules.test.ex1,
pacmanRules.test.ex2,
pacmanRules.test.ex3,
Expand Down
Loading