#!/usr/bin/perl -s use v5.16; use Test2::V0 '!float'; use PDL; use PDL::NiceSlice; our ($tests, $examples); run_tests() if $tests || $examples; # does not return die <qsort->(-1:0) > sequence(scalar @_))->((-1)) + 1; } ### Examples and tests sub run_tests { SKIP: { skip "examples" unless $examples; is hirsch(10, 8, 5, 4, 3), 4, 'example 1'; is hirsch(25, 8, 5, 3, 3), 3, 'example 2'; } SKIP: { skip "tests" unless $tests; is hirsch(9, 7, 6, 2, 1), 3, 'from Wikipedia'; is hirsch(1, 7, 6, 2, 9), 3, 'same, not sorted'; is hirsch(5, 5, 5, 5, 5), 5, 'last index'; } done_testing; exit; }