From 99ef47a429fb0c7e44183e4c0e2f9febeb4a8e05 Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Mon, 26 Feb 2024 22:12:44 +0100 Subject: Solution to task 2 --- challenge-258/jo-37/perl/ch-2.pl | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 challenge-258/jo-37/perl/ch-2.pl diff --git a/challenge-258/jo-37/perl/ch-2.pl b/challenge-258/jo-37/perl/ch-2.pl new file mode 100755 index 0000000000..c9bf4e62d7 --- /dev/null +++ b/challenge-258/jo-37/perl/ch-2.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl -s + +use v5.24; +use Test2::V0; +use List::Util 'sum0'; + +our ($tests, $examples, $bits); + +run_tests() if $tests || $examples; # does not return + +die < 2, 5, 9, 11, 3), 17, 'example 1'; + is k_bit_sum(2 ,=> 2, 5, 9, 11, 3), 11, 'example 2'; + is k_bit_sum(0 ,=> 2, 5, 9, 11, 3), 2, 'example 3'; + } + + SKIP: { + skip "tests" unless $tests; + } + + done_testing; + exit; +} -- cgit