diff options
| author | Mark Anderson <mark@andemark.io> | 2025-08-07 00:34:32 +0000 |
|---|---|---|
| committer | Mark Anderson <mark@andemark.io> | 2025-08-07 00:34:32 +0000 |
| commit | 1fcdd9cbcf6376a81dfcffedcd61f25ec9a9dcc9 (patch) | |
| tree | ca1d3eda08f2c52512075d09aa5922e46eac2aba | |
| parent | 93cc7afeb7874a23a59528970bf8f8c7382c40b3 (diff) | |
| download | perlweeklychallenge-club-1fcdd9cbcf6376a81dfcffedcd61f25ec9a9dcc9.tar.gz perlweeklychallenge-club-1fcdd9cbcf6376a81dfcffedcd61f25ec9a9dcc9.tar.bz2 perlweeklychallenge-club-1fcdd9cbcf6376a81dfcffedcd61f25ec9a9dcc9.zip | |
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) } |
