From 4e968a0a6ea4135e3ade5dedb901f24aca3ed823 Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Sun, 21 May 2023 12:38:18 +0200 Subject: Solution to task 2 --- challenge-217/jo-37/perl/ch-2.pl | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 challenge-217/jo-37/perl/ch-2.pl diff --git a/challenge-217/jo-37/perl/ch-2.pl b/challenge-217/jo-37/perl/ch-2.pl new file mode 100755 index 0000000000..f6145ffd7b --- /dev/null +++ b/challenge-217/jo-37/perl/ch-2.pl @@ -0,0 +1,59 @@ +#!/usr/bin/perl -s + +use v5.24; +use Test2::V0; + +our ($tests, $examples); + +run_tests() if $tests || $examples; # does not return + +die < $a . $b} @_; +} + + +### Examples and tests + +sub run_tests { + SKIP: { + skip "examples" unless $examples; + + is maximum_number(1, 23), 231, 'example 1'; + is maximum_number(10, 3, 2), 3210, 'example 2'; + is maximum_number(31, 2, 4, 10), 431210, 'example 3'; + is maximum_number(5, 11, 4, 1, 2), 542111, 'example 4'; + is maximum_number(1, 10), 110, 'example 5'; + } + + SKIP: { + skip "tests" unless $tests; + } + + done_testing; + exit; +} -- cgit