-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgraded tests for the following exercises: - Armstrong numbers - binary search - Bob - bowling - change
- Loading branch information
1 parent
e368b57
commit d3a3de7
Showing
10 changed files
with
673 additions
and
301 deletions.
There are no files selected for viewing
20 changes: 10 additions & 10 deletions
20
exercises/practice/armstrong-numbers/.meta/testAnnotation.json
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 |
---|---|---|
@@ -1,38 +1,38 @@ | ||
[ | ||
{ | ||
"name": "Zero is an Armstrong number", | ||
"test_code": "let\n Test.label.deprecated \"Zero is an Armstrong number\" <| Test.expect (isArmstrongNumber 0 === true)" | ||
"test_code": "verify do\n labeled \"Zero is an Armstrong number\" do\n expected = true\n actual = isArmstrongNumber 0\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "Single-digit numbers are Armstrong numbers", | ||
"test_code": "let\n Test.label.deprecated \"Single-digit numbers are Armstrong numbers\" <| Test.expect (isArmstrongNumber 5 === true)" | ||
"test_code": "verify do\n labeled \"Single-digit numbers are Armstrong numbers\" do\n expected = true\n actual = isArmstrongNumber 5\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "There are no two-digit Armstrong numbers", | ||
"test_code": "let\n Test.label.deprecated \"There are no two-digit Armstrong numbers\" <| Test.expect (isArmstrongNumber 10 === false)" | ||
"test_code": "verify do\n labeled \"There are no two-digit Armstrong numbers\" do\n expected = false\n actual = isArmstrongNumber 10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "Three-digit number that is an Armstrong number", | ||
"test_code": "let\n Test.label.deprecated \"Three-digit number that is an Armstrong number\" <| Test.expect (isArmstrongNumber 153 === true)" | ||
"test_code": "verify do\n labeled \"Three-digit number that is an Armstrong number\" do\n expected = true\n actual = isArmstrongNumber 153\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "Three-digit number that is not an Armstrong number", | ||
"test_code": "let\n Test.label.deprecated \"Three-digit number that is not an Armstrong number\" <| Test.expect (isArmstrongNumber 100 === false)" | ||
"test_code": "verify do\n labeled \"Three-digit number that is not an Armstrong number\" do\n expected = false\n actual = isArmstrongNumber 100\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "Four-digit number that is an Armstrong number", | ||
"test_code": "let\n Test.label.deprecated \"Four-digit number that is an Armstrong number\" <| Test.expect (isArmstrongNumber 9474 === true)" | ||
"test_code": "verify do\n labeled \"Four-digit number that is an Armstrong number\" do\n expected = true\n actual = isArmstrongNumber 9474\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "Four-digit number that is not an Armstrong number", | ||
"test_code": "let\n Test.label.deprecated \"Four-digit number that is not an Armstrong number\" <| Test.expect (isArmstrongNumber 9475 === false)" | ||
"test_code": "verify do\n labeled \"Four-digit number that is not an Armstrong number\" do\n expected = false\n actual = isArmstrongNumber 9475\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "Seven-digit number that is an Armstrong number", | ||
"test_code": "let\n Test.label.deprecated \"Seven-digit number that is an Armstrong number\" <| Test.expect (isArmstrongNumber 9926315 === true)" | ||
"test_code": "verify do\n labeled \"Seven-digit number that is an Armstrong number\" do\n expected = true\n actual = isArmstrongNumber 9926315\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "Seven-digit number that is not an Armstrong number", | ||
"test_code": "let\n Test.label.deprecated \"Seven-digit number that is not an Armstrong number\" <| Test.expect (isArmstrongNumber 9926314 === false)" | ||
"test_code": "verify do\n labeled \"Seven-digit number that is not an Armstrong number\" do\n expected = false\n actual = isArmstrongNumber 9926314\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
} | ||
] | ||
] |
84 changes: 65 additions & 19 deletions
84
exercises/practice/armstrong-numbers/armstrongNumbers.test.u
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
24 changes: 12 additions & 12 deletions
24
exercises/practice/binary-search/.meta/testAnnotation.json
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 |
---|---|---|
@@ -1,46 +1,46 @@ | ||
[ | ||
{ | ||
"name": "finds a value in an array with one element", | ||
"test_code": "expect (Some +0 === binarySearch.find (Array.fromList [6]) 6)\n |> Test.label.deprecated \"finds a value in an array with one element\"" | ||
"test_code": "verify do\n labeled \"finds a value in an array with one element\" do\n expected = Some +0\n actual = binarySearch.find (Array.fromList [6]) 6\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "finds a value in the middle of an array", | ||
"test_code": "expect (Some +3 === binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 6)\n |> Test.label.deprecated \"finds a value in the middle of an array\"" | ||
"test_code": "verify do\n labeled \"finds a value in the middle of an array\" do\n expected = Some +3\n actual = binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 6\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "finds a value at the beginning of an array", | ||
"test_code": "expect (Some +0 === binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 1)\n |> Test.label.deprecated \"finds a value at the beginning of an array\"" | ||
"test_code": "verify do\n labeled \"finds a value at the beginning of an array\" do\n expected = Some +0\n actual = binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 1\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "finds a value at the end of an array", | ||
"test_code": "expect (Some +6 === binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 11)\n |> Test.label.deprecated \"finds a value at the end of an array\"" | ||
"test_code": "verify do\n labeled \"finds a value at the end of an array\" do\n expected = Some +6\n actual = binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 11\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "finds a value in an array of odd length", | ||
"test_code": "expect (Some +9 === binarySearch.find (Array.fromList [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634]) 144)\n |> Test.label.deprecated \"finds a value in an array of odd length\"" | ||
"test_code": "verify do\n labeled \"finds a value in an array of odd length\" do\n expected = Some +9\n actual = binarySearch.find (Array.fromList [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634]) 144\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "finds a value in an array of even length", | ||
"test_code": "expect (Some +5 === binarySearch.find (Array.fromList [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377]) 21)\n |> Test.label.deprecated \"finds a value in an array of even length\"" | ||
"test_code": "verify do\n labeled \"finds a value in an array of even length\" do\n expected = Some +5\n actual = binarySearch.find (Array.fromList [1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377]) 21\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "identifies that a value is not included in the array", | ||
"test_code": "expect (None === binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 7)\n |> Test.label.deprecated \"identifies that a value is not included in the array\"" | ||
"test_code": "verify do\n labeled \"identifies that a value is not included in the array\" do\n expected = None\n actual = binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 7\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "a value smaller than the array's smallest value is not found", | ||
"test_code": "expect (None === binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 0)\n |> Test.label.deprecated \"a value smaller than the array's smallest value is not found\"" | ||
"test_code": "verify do\n labeled \"a value smaller than the array's smallest value is not found\" do\n expected = None\n actual = binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 0\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "a value larger than the array's largest value is not found", | ||
"test_code": "expect (None === binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 13)\n |> Test.label.deprecated \"a value larger than the array's largest value is not found\"" | ||
"test_code": "verify do\n labeled \"a value larger than the array's largest value is not found\" do\n expected = None\n actual = binarySearch.find (Array.fromList [1, 3, 4, 6, 8, 9, 11]) 13\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "nothing is found in an empty array", | ||
"test_code": "expect (None === binarySearch.find (Array.fromList []) 1)\n |> Test.label.deprecated \"nothing is found in an empty array\"" | ||
"test_code": "verify do\n labeled \"nothing is found in an empty array\" do\n expected = None\n actual = binarySearch.find (Array.fromList []) 1\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
}, | ||
{ | ||
"name": "nothing is found when the left and right bounds cross", | ||
"test_code": "expect (None === binarySearch.find (Array.fromList [1, 2]) 0)\n |> Test.label.deprecated \"nothing is found when the left and right bounds cross\"" | ||
"test_code": "verify do\n labeled \"nothing is found when the left and right bounds cross\" do\n expected = None\n actual = binarySearch.find (Array.fromList [1, 2]) 0\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" | ||
} | ||
] | ||
] |
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
Oops, something went wrong.