Skip to content

Commit

Permalink
Remove old test version, reference canonical data
Browse files Browse the repository at this point in the history
  • Loading branch information
bgottlob committed Oct 15, 2018
1 parent 3ea7c80 commit badee01
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
19 changes: 0 additions & 19 deletions exercises/list-ops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,6 @@ directory.
$ rebar3 eunit
```

### Test versioning

Each problem defines a macro `TEST_VERSION` in the test file and
verifies that the solution defines and exports a function `test_version`
returning that same value.

To make tests pass, add the following to your solution:

```erlang
-export([test_version/0]).

test_version() ->
1.
```

The benefit of this is that reviewers can see against which test version
an iteration was written if, for example, a previously posted solution
does not solve the current problem or passes current tests.

## Questions?

For detailed information about the Erlang track, please refer to the
Expand Down
5 changes: 1 addition & 4 deletions exercises/list-ops/src/example.erl
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
-module(example).

-export([append/2, concat/1, filter/2, length/1, map/2, foldl/3, foldr/3,
reverse/1, test_version/0]).

test_version() ->
1.
reverse/1]).

append(L1, L2) -> L1 ++ L2.

Expand Down
4 changes: 1 addition & 3 deletions exercises/list-ops/src/list_ops.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-module(list_ops).

-export([append/2, concat/1, filter/2, length/1, map/2, foldl/3, foldr/3,
reverse/1, test_version/0]).
reverse/1]).

append(_List1, _List2) -> undefined.

Expand All @@ -18,5 +18,3 @@ foldl(_Function, _Start, _List) -> undefined.
foldr(_Function, _Start, _List) -> undefined.

reverse(_List) -> undefined.

test_version() -> 1.
5 changes: 3 additions & 2 deletions exercises/list-ops/test/list_ops_tests.erl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
%% based on canonical data version 2.3.0
%% https://raw.githubusercontent.com/exercism/problem-specifications/master/exercises/list-ops/canonical-data.json

-module(list_ops_tests).

-include_lib("erl_exercism/include/exercism.hrl").
Expand Down Expand Up @@ -82,5 +85,3 @@ reverse_empty_list_test() ->
reverse_non_empty_list_test() ->
?assertEqual([7,5,3,1],
list_ops:reverse([1,3,5,7])).

version_test() -> ?assertMatch(1, list_ops:test_version()).

0 comments on commit badee01

Please sign in to comment.