diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2025-08-07 11:09:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-07 11:09:44 +0100 |
| commit | 7b607f3fe5f13d629216d83fb7d25626a4dc98f5 (patch) | |
| tree | daa5f3a558794514062c5f1075087ba5edfd5d43 | |
| parent | 293643b7e3708a8e780366362774d222732333ba (diff) | |
| parent | 1fcdd9cbcf6376a81dfcffedcd61f25ec9a9dcc9 (diff) | |
| download | perlweeklychallenge-club-7b607f3fe5f13d629216d83fb7d25626a4dc98f5.tar.gz perlweeklychallenge-club-7b607f3fe5f13d629216d83fb7d25626a4dc98f5.tar.bz2 perlweeklychallenge-club-7b607f3fe5f13d629216d83fb7d25626a4dc98f5.zip | |
Merge pull request #12478 from andemark/challenge-333
ch-1.raku fix and more tests
| -rw-r--r-- | challenge-333/mark-anderson/raku/ch-1.raku | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/challenge-333/mark-anderson/raku/ch-1.raku b/challenge-333/mark-anderson/raku/ch-1.raku index 32a862d920..753138c96c 100644 --- a/challenge-333/mark-anderson/raku/ch-1.raku +++ b/challenge-333/mark-anderson/raku/ch-1.raku @@ -7,8 +7,39 @@ nok straight-line([0,0], [1,1], [2,3]); ok straight-line([1,1], [1,1], [1,1]); ok straight-line([1000000,1000000], [2000000,2000000], [3000000,3000000]); +# Athanasius +ok straight-line([1,2], [1,2], [2,3], [3,4]), 'Duplicate 1'; +nok straight-line([1,2], [1,2], [2,3], [3,5]), 'Duplicate 2'; +ok straight-line([1,2], [1,2], [2,3], [1,2]), 'Duplicate 3'; +ok straight-line([4,9]), 'Singleton'; +ok straight-line([4,9], [7,6]), 'Pair'; +ok straight-line([-1.5,0.3], [-2.5,-0.7], [-3.5,-1.7]), 'Reals'; + +# E Choroba +ok straight-line([0,0]), 'single point'; +ok straight-line([0,1], [1,0]), 'two points'; +ok straight-line([1,4], [2,6], [3,8], [4,10]), 'Four points'; +ok straight-line([0,1], [2,3], [3,4], [-5,-4]), 'Negative values'; +ok straight-line([1,2], [3,7], [3,7]), 'B=C'; +ok straight-line([1,2], [3,7], [1,2]), 'A=C'; +ok straight-line([1,2], [1,2], [3,7]), 'A=B'; +nok straight-line([2,1], [2,3], [3,4]), 'Not y'; +nok straight-line([2,1], [3,3], [2,4]), 'Not y'; +nok straight-line([3,1], [2,3], [2,4]), 'Not y'; +nok straight-line([3,2], [1,3], [1,4]), 'Not x'; +nok straight-line([1,2], [3,3], [1,4]), 'Not x'; +nok straight-line([1,2], [1,3], [3,4]), 'Not x'; + +# Peter Campbell Smith +nok straight-line([0,0], [1,1], [99999999,100000000]); +ok straight-line([8,-5], [3,-2], [-2,1]); +ok straight-line([8,-5], [3,-2], [-2,1], [-7,4], [-12,7]); +nok straight-line([0,0], [1,0], [2,1], [3,2]); + sub straight-line(+@points) { + @points .= unique(with => &[eqv]); + return True if @points < 3; [==] @points.rotor(2 => -1).flat.map(&slope) } |
