From 88fb71ed321efb0ed032accaa14e09e51509e0fe Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Wed, 31 May 2023 10:38:11 +0200 Subject: Solution to task 1 --- challenge-219/jo-37/perl/ch-1.pl | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 challenge-219/jo-37/perl/ch-1.pl diff --git a/challenge-219/jo-37/perl/ch-1.pl b/challenge-219/jo-37/perl/ch-1.pl new file mode 100755 index 0000000000..7f0fd3232d --- /dev/null +++ b/challenge-219/jo-37/perl/ch-1.pl @@ -0,0 +1,56 @@ +#!/usr/bin/perl -s + +use v5.24; +use Test2::V0; + +our ($tests, $examples); + +run_tests() if $tests || $examples; # does not return + +die < $b} map $_ * $_, @_; +} + + +### Examples and tests + +sub run_tests { + SKIP: { + skip "examples" unless $examples; + + is [sorted_squares(-2, -1, 0, 3, 4)], + [0, 1, 4, 9, 16], 'example 1'; + + is [sorted_squares(5, -4, -1, 3, 6)], + [1, 9, 16, 25, 36], 'example 2'; + } + + SKIP: { + skip "tests" unless $tests; + } + + done_testing; + exit; +} -- cgit