Skip to content

Commit

Permalink
🚚 builtin: Rename evy builtin assert to test (#418)
Browse files Browse the repository at this point in the history
Rename evy builtin `assert` to `test` as test seems to be a more
intuitive name than assert. Full disclosure @camh- said all along it
should `test`, but I felt the concept of a test is an abstraction level
higher, a collection of many asserts or so. I had to rename all
human-eval samples from `func test` to `func testAll`.

Still it seems with a bit of distance and reading the builtin docs
afresh: test is the more intuitive name.

Fix up all examples and re-generate docs in separate commits for better
reviewability.

This merges the following commits:
* builtin: Rename evy builtin `assert` to `test` (1/3)
* builtin: Rename evy builtin `assert` to `test` (2/3)
* builtin: Rename evy builtin `assert` to `test` (3/3)

     docs/builtins.md                             |  50 +++----
     docs/usage.md                                |  21 ++-
     examples/human-eval/000.evy                  |  18 +--
     examples/human-eval/001.evy                  |  12 +-
     examples/human-eval/002.evy                  |  10 +-
     examples/human-eval/003.evy                  |  16 +--
     examples/human-eval/004.evy                  |  10 +-
     examples/human-eval/005.evy                  |  10 +-
     examples/human-eval/006.evy                  |  10 +-
     examples/human-eval/007.evy                  |  12 +-
     examples/human-eval/008.evy                  |  14 +-
     examples/human-eval/009.evy                  |  12 +-
     examples/human-eval/010.evy                  |  16 +--
     examples/human-eval/011.evy                  |  10 +-
     examples/human-eval/012.evy                  |  10 +-
     examples/human-eval/013.evy                  |  12 +-
     examples/human-eval/014.evy                  |  10 +-
     examples/human-eval/015.evy                  |  10 +-
     examples/human-eval/016.evy                  |  14 +-
     examples/human-eval/017.evy                  |  14 +-
     examples/human-eval/018.evy                  |  12 +-
     examples/human-eval/019.evy                  |  14 +-
     examples/human-eval/020.evy                  |  14 +-
     examples/human-eval/021.evy                  |  14 +-
     examples/human-eval/022.evy                  |  10 +-
     examples/human-eval/023.evy                  |  10 +-
     examples/human-eval/024.evy                  |  14 +-
     examples/human-eval/025.evy                  |  20 +--
     examples/human-eval/026.evy                  |  10 +-
     examples/human-eval/027.evy                  |  10 +-
     examples/human-eval/028.evy                  |  10 +-
     examples/human-eval/029.evy                  |   8 +-
     examples/human-eval/030.evy                  |  12 +-
     examples/human-eval/031.evy                  |  30 ++--
     examples/human-eval/033.evy                  |  18 +--
     examples/human-eval/034.evy                  |   8 +-
     examples/human-eval/035.evy                  |   8 +-
     examples/human-eval/036.evy                  |  20 +--
     examples/human-eval/037.evy                  |  10 +-
     examples/human-eval/038.evy                  |  14 +-
     examples/human-eval/039.evy                  |  24 ++--
     examples/human-eval/040.evy                  |  22 +--
     examples/human-eval/041.evy                  |  14 +-
     examples/human-eval/042.evy                  |  10 +-
     examples/human-eval/043.evy                  |  22 +--
     examples/human-eval/044.evy                  |  18 +--
     examples/human-eval/045.evy                  |  10 +-
     examples/human-eval/046.evy                  |  12 +-
     examples/human-eval/047.evy                  |  14 +-
     examples/human-eval/048.evy                  |  18 +--
     examples/human-eval/049.evy                  |  18 +--
     examples/human-eval/050.evy                  |  14 +-
     examples/human-eval/051.evy                  |  18 +--
     examples/human-eval/052.evy                  |  16 +--
     examples/human-eval/053.evy                  |  14 +-
     examples/human-eval/054.evy                  |  18 +--
     examples/human-eval/055.evy                  |  14 +-
     examples/human-eval/056.evy                  |  30 ++--
     examples/human-eval/057.evy                  |  20 +--
     examples/human-eval/058.evy                  |  12 +-
     examples/human-eval/059.evy                  |  14 +-
     examples/human-eval/060.evy                  |  14 +-
     examples/human-eval/061.evy                  |  28 ++--
     examples/human-eval/062.evy                  |  14 +-
     examples/human-eval/063.evy                  |  18 +--
     examples/human-eval/064.evy                  |  20 +--
     examples/human-eval/065.evy                  |  20 +--
     examples/human-eval/066.evy                  |  20 +--
     examples/human-eval/067.evy                  |  18 +--
     examples/human-eval/068.evy                  |  20 +--
     examples/human-eval/069.evy                  |  54 ++++----
     examples/human-eval/070.evy                  |  22 +--
     examples/human-eval/071.evy                  |  22 +--
     examples/human-eval/072.evy                  |  16 +--
     examples/human-eval/073.evy                  |  20 +--
     examples/human-eval/074.evy                  |  22 +--
     examples/human-eval/075.evy                  |  24 ++--
     examples/human-eval/076.evy                  |  30 ++--
     examples/human-eval/077.evy                  |  20 +--
     examples/human-eval/078.evy                  |  18 +--
     examples/human-eval/079.evy                  |  12 +-
     examples/human-eval/080.evy                  |  20 +--
     examples/human-eval/081.evy                  |  16 +--
     examples/human-eval/082.evy                  |  36 ++---
     examples/human-eval/083.evy                  |  14 +-
     examples/human-eval/084.evy                  |  14 +-
     examples/human-eval/085.evy                  |  12 +-
     examples/human-eval/086.evy                  |  18 +--
     examples/human-eval/087.evy                  |  16 +--
     examples/human-eval/088.evy                  |  18 +--
     examples/human-eval/089.evy                  |  20 +--
     examples/human-eval/090.evy                  |  16 +--
     examples/human-eval/091.evy                  |  20 +--
     examples/human-eval/092.evy                  |  22 +--
     examples/human-eval/093.evy                  |  14 +-
     examples/human-eval/094.evy                  |  16 +--
     examples/human-eval/095.evy                  |  16 +--
     examples/human-eval/096.evy                  |  24 ++--
     examples/human-eval/097.evy                  |  20 +--
     examples/human-eval/098.evy                  |  18 +--
     examples/human-eval/099.evy                  |  14 +-
     examples/human-eval/100.evy                  |  14 +-
     examples/human-eval/101.evy                  |  16 +--
     examples/human-eval/102.evy                  |  20 +--
     examples/human-eval/103.evy                  |  28 ++--
     examples/human-eval/104.evy                  |  12 +-
     examples/human-eval/105.evy                  |  14 +-
     examples/human-eval/106.evy                  |  12 +-
     examples/human-eval/107.evy                  |  20 +--
     examples/human-eval/108.evy                  |  20 +--
     examples/human-eval/109.evy                  |  24 ++--
     examples/human-eval/110.evy                  |  18 +--
     examples/human-eval/111.evy                  |  20 +--
     examples/human-eval/112.evy                  |  22 +--
     examples/human-eval/113.evy                  |  10 +-
     examples/human-eval/114.evy                  |  32 ++---
     examples/human-eval/115.evy                  |  14 +-
     examples/human-eval/116.evy                  |  20 +--
     examples/human-eval/117.evy                  |  18 +--
     examples/human-eval/118.evy                  |  30 ++--
     examples/human-eval/119.evy                  |  28 ++--
     examples/human-eval/120.evy                  |  26 ++--
     examples/human-eval/121.evy                  |  18 +--
     examples/human-eval/122.evy                  |  14 +-
     examples/human-eval/123.evy                  |  12 +-
     examples/human-eval/124.evy                  |  36 ++---
     examples/human-eval/125.evy                  |  20 +--
     examples/human-eval/126.evy                  |  30 ++--
     examples/human-eval/127.evy                  |  20 +--
     examples/human-eval/128.evy                  |  20 +--
     examples/human-eval/129.evy                  |  24 ++--
     examples/human-eval/130.evy                  |  24 ++--
     examples/human-eval/131.evy                  |  18 +--
     examples/human-eval/132.evy                  |  32 ++---
     examples/human-eval/133.evy                  |  28 ++--
     examples/human-eval/134.evy                  |  24 ++--
     examples/human-eval/135.evy                  |  14 +-
     examples/human-eval/136.evy                  |  26 ++--
     examples/human-eval/137.evy                  |  20 +--
     examples/human-eval/138.evy                  |  20 +--
     examples/human-eval/139.evy                  |  14 +-
     examples/human-eval/140.evy                  |  14 +-
     examples/human-eval/141.evy                  |  56 ++++----
     examples/human-eval/142.evy                  |  26 ++--
     examples/human-eval/143.evy                  |  18 +--
     examples/human-eval/144.evy                  |  30 ++--
     examples/human-eval/145.evy                  |  16 +--
     examples/human-eval/146.evy                  |  18 +--
     examples/human-eval/147.evy                  |  12 +-
     examples/human-eval/148.evy                  |  18 +--
     examples/human-eval/149.evy                  |  22 +--
     examples/human-eval/150.evy                  |  24 ++--
     examples/human-eval/151.evy                  |  16 +--
     examples/human-eval/152.evy                  |  12 +-
     examples/human-eval/153.evy                  |  22 +--
     examples/human-eval/154.evy                  |  16 +--
     examples/human-eval/155.evy                  |  20 +--
     examples/human-eval/156.evy                  |  32 ++---
     examples/human-eval/157.evy                  |  26 ++--
     examples/human-eval/158.evy                  |  24 ++--
     examples/human-eval/159.evy                  |  16 +--
     examples/human-eval/160.evy                  |  18 +--
     examples/human-eval/161.evy                  |  20 +--
     examples/human-eval/163.evy                  |  12 +-
     examples/human-eval/too-hard-for-now/162.evy |  12 +-
     examples/human-eval/too-hard-for-now/32.evy  |   6 +-
     frontend/docs/builtins.html                  |  54 ++++----
     frontend/docs/builtins.htmlf                 |  54 ++++----
     frontend/docs/index.html                     |   2 +-
     frontend/docs/spec.html                      |   2 +-
     frontend/docs/syntax-by-example.html         |   2 +-
     frontend/docs/talks-and-papers.html          |   2 +-
     frontend/docs/usage.html                     |  21 ++-
     frontend/docs/usage.htmlf                    |  21 ++-
     main.go                                      |  18 +--
     pkg/evaluator/assertinfo.go                  |  50 -------
     pkg/evaluator/builtin.go                     |  30 ++--
     pkg/evaluator/evaluator.go                   |  36 ++---
     pkg/evaluator/evaluator_test.go              | 136 +++++++++----------
     pkg/evaluator/testinfo.go                    |  50 +++++++
     180 files changed, 1759 insertions(+), 1762 deletions(-)

Pull-request: #418
  • Loading branch information
juliaogris committed Aug 24, 2024
2 parents 2222497 + d364e85 commit fd47902
Show file tree
Hide file tree
Showing 180 changed files with 1,759 additions and 1,762 deletions.
50 changes: 25 additions & 25 deletions docs/builtins.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ see [syntax by example](syntax-by-example.md).
3. [**Map**](#map)
[has](#has), [del](#del)
4. [**Program control**](#program-control)
[sleep](#sleep), [exit](#exit), [panic](#panic), [assert](#assert)
[sleep](#sleep), [exit](#exit), [panic](#panic), [test](#test)
5. [**Conversion**](#conversion)
[str2num](#str2num), [str2bool](#str2bool)
6. [**Errors**](#errors)
Expand Down Expand Up @@ -511,75 +511,75 @@ line 4 column 5: scale must be positive
The `panic` function takes a single argument, which is the error message
that the program will print before it terminates with exit status 1.

### `assert`
### `test`

`assert` is used to check if a condition is true or two values – `want` and
`test` is used to check if a condition is true or two values – `want` and
`got` – are the same. If the condition is not true or the two values are not
the same, the program will print the failed assertion and terminate with exit
the same, the program will print the failed test and terminate with exit
status 1.

`assert` optionally takes a message or a formatted message with arguments to
print along with the failed assertion as a third and following arguments:
`test` optionally takes a message or a format string with arguments to
print along with the failed test as a third and following arguments:

#### Example

```evy:err
answer := 6 * 9
assert 42 answer "answer is 42 not %v" answer
test 42 answer "answer is 42 not %v" answer
```

Output

```evy:output
❌ 1 failed assertion
✔️ 0 passed assertions
line 2 column 11: failed assertion: want != got: 42 != 54 (answer is 42 not 54)
❌ 1 failed test
✔️ 0 passed tests
line 2 column 9: failed test: want != got: 42 != 54 (answer is 42 not 54)
```

#### Reference

assert cond:bool
assert want:any got:any [msg:string [argsany...]]
test cond:bool
test want:any got:any [msg:string [argsany...]]

The `assert` function takes either a single boolean argument `cond`
The `test` function takes either a single boolean argument `cond`
and ensures it is `true`, or two arguments `want` and `got`, in that order,
and ensures they are the same.

In the case of the single argument, the argument must be of type `bool`.
`assert` verifies that this argument has the value `true`. If `cond` is false,
`assert` terminates the program execution and prints the failed assertion.
`test` verifies that this argument has the value `true`. If `cond` is false,
`test` terminates the program execution and prints the failed test.

In the case of two arguments, `want` and `got`, `assert` verifies
the arguments are the same. If they are not the same `assert` terminates the
program execution and prints the failed assertion.
In the case of two arguments, `want` and `got`, `test` verifies
the arguments are the same. If they are not the same `test` terminates the
program execution and prints the failed test.

**Sameness** of `want` and `got` means either `want == got` or `want` and
`got` are composite values, arrays or maps, containing the same values.
`want` can be of a more _specific_ type than `got` as long as their values
are the same. For example, the following assertion holds true even though
are the same. For example, the following test holds true even though
`want` is of type `[][]num` and `got` is of type `[]any`.

```evy
got:[]any
got = [[1] [2 3]]
assert [[1] [2 3]] got
test [[1] [2 3]] got
```

In the case of three arguments, the third argument is a message of type
`string` that is printed if the assertion fails.
`string` that is printed if the test fails.

In case of four or more arguments, the third argument is a _format string_
with _specifiers_. The remaining arguments are the arguments are used to
replace these specifiers, see [`sprintf`](#sprintf) for details on
formatting. This means the following two assertions are equivalent.
formatting. This means the following two tests are equivalent.

```evy
val := 2
assert 1 val "val is %v" val
assert 1 val (sprintf "val is %v" val)
test 1 val "val is %v" val
test 1 val (sprintf "val is %v" val)
```

Using `assert` with four or more arguments is a convenience compared to adding
Using `test` with four or more arguments is a convenience compared to adding
an inline call to `sprintf`.

## Conversion
Expand Down
21 changes: 10 additions & 11 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,16 @@ You can also get help for each subcommand by running it with the
[<source>] Source file. Default: stdin.

Flags:
-h, --help Show context-sensitive help.
-V, --version Print version information

--skip-sleep Skip evy sleep command ($EVY_SKIP_SLEEP).
--svg-out=FILE Output drawing to SVG file. Stdout: -.
--svg-style=STYLE Style of top-level SVG element.
-s, --no-assertion-summary Do not print assertion summary, only report
failed assertion(s).
--fail-fast Stop execution on first failed assertion.
-t, --txtar=MEMBER Read source from txtar file and select select
given filename
-h, --help Show context-sensitive help.
-V, --version Print version information

--skip-sleep Skip evy sleep command ($EVY_SKIP_SLEEP).
--svg-out=FILE Output drawing to SVG file. Stdout: -.
--svg-style=STYLE Style of top-level SVG element.
-s, --no-test-summary Do not print test summary, only report failed tests.
--fail-fast Stop execution on first failed test.
-t, --txtar=MEMBER Read source from txtar file and select select given
filename

<!-- genend -->

Expand Down
18 changes: 9 additions & 9 deletions examples/human-eval/000.evy
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ func hasCloseElements:bool numbers:[]num threshold:num
return false
end

func test
assert true (hasCloseElements [1 2 3.9 4 5 2.2] 0.3)
assert false (hasCloseElements [1 2 3.9 4 5 2.2] 0.05)
assert true (hasCloseElements [1 2 5.9 4 5] 0.95)
assert false (hasCloseElements [1 2 5.9 4 5] 0.8)
assert true (hasCloseElements [1 2 3 4 5 2] 0.1)
assert true (hasCloseElements [1.1 2.2 3.1 4.1 5.1] 1)
assert false (hasCloseElements [1.1 2.2 3.1 4.1 5.1] 0.5)
func testAll
test true (hasCloseElements [1 2 3.9 4 5 2.2] 0.3)
test false (hasCloseElements [1 2 3.9 4 5 2.2] 0.05)
test true (hasCloseElements [1 2 5.9 4 5] 0.95)
test false (hasCloseElements [1 2 5.9 4 5] 0.8)
test true (hasCloseElements [1 2 3 4 5 2] 0.1)
test true (hasCloseElements [1.1 2.2 3.1 4.1 5.1] 1)
test false (hasCloseElements [1.1 2.2 3.1 4.1 5.1] 0.5)
end

test
testAll
12 changes: 6 additions & 6 deletions examples/human-eval/001.evy
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func separateParenGroups:[]string paren_string:string
return result
end

func test
assert ["(()())" "((()))" "()" "((())()())"] (separateParenGroups "(()()) ((())) () ((())()())")
assert ["()" "(())" "((()))" "(((())))"] (separateParenGroups "() (()) ((())) (((())))")
assert ["(()(())((())))"] (separateParenGroups "(()(())((())))")
assert ["()" "(())" "(()())"] (separateParenGroups "( ) (( )) (( )( ))")
func testAll
test ["(()())" "((()))" "()" "((())()())"] (separateParenGroups "(()()) ((())) () ((())()())")
test ["()" "(())" "((()))" "(((())))"] (separateParenGroups "() (()) ((())) (((())))")
test ["(()(())((())))"] (separateParenGroups "(()(())((())))")
test ["()" "(())" "(()())"] (separateParenGroups "( ) (( )) (( )( ))")
end

test
testAll
10 changes: 5 additions & 5 deletions examples/human-eval/002.evy
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ func truncateNumber:num number:num
return number % 1
end

func test
assert 0.5 (truncateNumber 3.5)
assert true (((abs (truncateNumber (1.33 - 0.33))) < 0.000001))
assert true (((abs (truncateNumber (123.456 - 0.456))) < 0.000001))
func testAll
test 0.5 (truncateNumber 3.5)
test true (((abs (truncateNumber (1.33 - 0.33))) < 0.000001))
test true (((abs (truncateNumber (123.456 - 0.456))) < 0.000001))
end

test
testAll
16 changes: 8 additions & 8 deletions examples/human-eval/003.evy
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ func belowZero:bool operations:[]num
return false
end

func test
assert false (belowZero [])
assert false (belowZero [1 2 -3 1 2 -3])
assert true (belowZero [1 2 -4 5 6])
assert false (belowZero [1 -1 2 -2 5 -5 4 -4])
assert true (belowZero [1 -1 2 -2 5 -5 4 -5])
assert true (belowZero [1 -2 2 -2 5 -5 4 -4])
func testAll
test false (belowZero [])
test false (belowZero [1 2 -3 1 2 -3])
test true (belowZero [1 2 -4 5 6])
test false (belowZero [1 -1 2 -2 5 -5 4 -4])
test true (belowZero [1 -1 2 -2 5 -5 4 -5])
test true (belowZero [1 -2 2 -2 5 -5 4 -4])
end

test
testAll
10 changes: 5 additions & 5 deletions examples/human-eval/004.evy
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ func sum:num numbers:[]num
return total
end

func test
assert true ((abs ((meanAbsoluteDeviation [1 2 3]) - 2 / 3)) < 0.000001)
assert true ((abs ((meanAbsoluteDeviation [1 2 3 4]) - 1)) < 0.000001)
assert true ((abs ((meanAbsoluteDeviation [1 2 3 4 5]) - 6 / 5)) < 0.000001)
func testAll
test true ((abs ((meanAbsoluteDeviation [1 2 3]) - 2 / 3)) < 0.000001)
test true ((abs ((meanAbsoluteDeviation [1 2 3 4]) - 1)) < 0.000001)
test true ((abs ((meanAbsoluteDeviation [1 2 3 4 5]) - 6 / 5)) < 0.000001)
end

test
testAll
10 changes: 5 additions & 5 deletions examples/human-eval/005.evy
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ func intersperse:[]num numbers:[]num delimeter:num
return result
end

func test
assert [] (intersperse [] 7)
assert [5 8 6 8 3 8 2] (intersperse [5 6 3 2] 8)
assert [2 2 2 2 2] (intersperse [2 2 2] 2)
func testAll
test [] (intersperse [] 7)
test [5 8 6 8 3 8 2] (intersperse [5 6 3 2] 8)
test [2 2 2 2 2] (intersperse [2 2 2] 2)
end

test
testAll
10 changes: 5 additions & 5 deletions examples/human-eval/006.evy
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ func parseNestedParens:[]num paren_string:string
return result
end

func test
assert [2 3 1 3] (parseNestedParens "(()()) ((())) () ((())()())")
assert [1 2 3 4] (parseNestedParens "() (()) ((())) (((())))")
assert [4] (parseNestedParens "(()(())((())))")
func testAll
test [2 3 1 3] (parseNestedParens "(()()) ((())) () ((())()())")
test [1 2 3 4] (parseNestedParens "() (()) ((())) (((())))")
test [4] (parseNestedParens "(()(())((())))")
end

test
testAll
12 changes: 6 additions & 6 deletions examples/human-eval/007.evy
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ func contains:bool haystack:string needle:string
return false
end

func test
assert [] (filter [] "john")
assert ["xxx" "xxxAAA" "xxx"] (filter ["xxx" "asd" "xxy" "john doe" "xxxAAA" "xxx"] "xxx")
assert ["xxx" "aaaxxy" "xxxAAA" "xxx"] (filter ["xxx" "asd" "aaaxxy" "john doe" "xxxAAA" "xxx"] "xx")
assert ["grunt" "prune"] (filter ["grunt" "trumpet" "prune" "gruesome"] "run")
func testAll
test [] (filter [] "john")
test ["xxx" "xxxAAA" "xxx"] (filter ["xxx" "asd" "xxy" "john doe" "xxxAAA" "xxx"] "xxx")
test ["xxx" "aaaxxy" "xxxAAA" "xxx"] (filter ["xxx" "asd" "aaaxxy" "john doe" "xxxAAA" "xxx"] "xx")
test ["grunt" "prune"] (filter ["grunt" "trumpet" "prune" "gruesome"] "run")
end

test
testAll
14 changes: 7 additions & 7 deletions examples/human-eval/008.evy
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ func sumProduct:[]num numbers:[]num
return [sum_value prod_value]
end

func test
assert [0 1] (sumProduct [])
assert [3 1] (sumProduct [1 1 1])
assert [100 0] (sumProduct [100 0])
assert [15 105] (sumProduct [3 5 7])
assert [10 10] (sumProduct [10])
func testAll
test [0 1] (sumProduct [])
test [3 1] (sumProduct [1 1 1])
test [100 0] (sumProduct [100 0])
test [15 105] (sumProduct [3 5 7])
test [10 10] (sumProduct [10])
end

test
testAll
12 changes: 6 additions & 6 deletions examples/human-eval/009.evy
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ func rollingMax:[]num numbers:[]num
return result
end

func test
assert [] (rollingMax [])
assert [1 2 3 4] (rollingMax [1 2 3 4])
assert [4 4 4 4] (rollingMax [4 3 2 1])
assert [3 3 3 100 100] (rollingMax [3 2 3 100 3])
func testAll
test [] (rollingMax [])
test [1 2 3 4] (rollingMax [1 2 3 4])
test [4 4 4 4] (rollingMax [4 3 2 1])
test [3 3 3 100 100] (rollingMax [3 2 3 100 3])
end

test
testAll
16 changes: 8 additions & 8 deletions examples/human-eval/010.evy
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ func reverse:string str:string
return reversed
end

func test
assert "" (makePalindrome "")
assert "x" (makePalindrome "x")
assert "xyzyx" (makePalindrome "xyz")
assert "xyx" (makePalindrome "xyx")
assert "catac" (makePalindrome "cata")
assert "jerryrrej" (makePalindrome "jerry")
func testAll
test "" (makePalindrome "")
test "x" (makePalindrome "x")
test "xyzyx" (makePalindrome "xyz")
test "xyx" (makePalindrome "xyx")
test "catac" (makePalindrome "cata")
test "jerryrrej" (makePalindrome "jerry")
end

test
testAll
10 changes: 5 additions & 5 deletions examples/human-eval/011.evy
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ func stringXor:string a:string b:string
return res
end

func test
assert "010010" (stringXor "111000" "101010")
assert "0" (stringXor "1" "1")
assert "0101" (stringXor "0101" "0000")
func testAll
test "010010" (stringXor "111000" "101010")
test "0" (stringXor "1" "1")
test "0101" (stringXor "0101" "0000")
end

test
testAll
10 changes: 5 additions & 5 deletions examples/human-eval/012.evy
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func longest:string strings:[]string
return ""
end

func test
assert "" (longest [])
assert "x" (longest ["x" "y" "z"])
assert "zzzz" (longest ["x" "yyy" "zzzz" "www" "kkkk" "abc"])
func testAll
test "" (longest [])
test "x" (longest ["x" "y" "z"])
test "zzzz" (longest ["x" "yyy" "zzzz" "www" "kkkk" "abc"])
end

test
testAll
12 changes: 6 additions & 6 deletions examples/human-eval/013.evy
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ func gcd:num a:num b:num
return a
end

func test
assert 1 (gcd 3 7)
assert 5 (gcd 10 15)
assert 7 (gcd 49 14)
assert 12 (gcd 144 60)
func testAll
test 1 (gcd 3 7)
test 5 (gcd 10 15)
test 7 (gcd 49 14)
test 12 (gcd 144 60)
end

test
testAll
Loading

0 comments on commit fd47902

Please sign in to comment.