File tree Expand file tree Collapse file tree
exercises/practice/tournament Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # This is an auto-generated file. Regular comments will be removed when this
2- # file is regenerated. Regenerating will not touch any manually added keys,
3- # so comments can be added in a "comment" key.
1+ # This is an auto-generated file.
2+ #
3+ # Regenerating this file via `configlet sync` will:
4+ # - Recreate every `description` key/value pair
5+ # - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+ # - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+ # - Preserve any other key/value pair
8+ #
9+ # As user-added comments (using the # character) will be removed when this file
10+ # is regenerated, comments can be added via a `comment` key.
411
512[67e9fab1-07c1-49cf-9159-bc8671cc7c9c ]
613description = " just the header if no input"
@@ -34,3 +41,6 @@ description = "incomplete competition (not all pairs have played)"
3441
3542[3aa0386f-150b-4f99-90bb-5195e7b7d3b8 ]
3643description = " ties broken alphabetically"
44+
45+ [f9e20931-8a65-442a-81f6-503c0205b17a ]
46+ description = " ensure points sorted numerically"
Original file line number Diff line number Diff line change @@ -62,6 +62,24 @@ describe('tournament', function()
6262 assert .are .same (expected , tournament (results ))
6363 end )
6464
65+ it (' should ensure points are sorted numerically' , function ()
66+ local results = {
67+ ' Devastating Donkeys;Blithering Badgers;win' ,
68+ ' Devastating Donkeys;Blithering Badgers;win' ,
69+ ' Devastating Donkeys;Blithering Badgers;win' ,
70+ ' Devastating Donkeys;Blithering Badgers;win' ,
71+ ' Blithering Badgers;Devastating Donkeys;win'
72+ }
73+
74+ local expected = {
75+ ' Team | MP | W | D | L | P' ,
76+ ' Devastating Donkeys | 5 | 4 | 0 | 1 | 12' ,
77+ ' Blithering Badgers | 5 | 1 | 0 | 4 | 3'
78+ }
79+
80+ assert .are .same (expected , tournament (results ))
81+ end )
82+
6583 it (' should ignore blank lines' , function ()
6684 local results = {
6785 ' Allegoric Alaskans;Blithering Badgers;win' ,
You can’t perform that action at this time.
0 commit comments