aboutsummaryrefslogtreecommitdiff
path: root/challenge-273/bruce-gray/perl/ch-2.pl
blob: a4f905bd3f20f114b6d2797e66a6f91dc16d9f31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!perl
use v5.40;

sub task2 ($str) {
    return $str =~ / ^ [^b]* b [^a]* $ /msx;
}


my @tests = (
    'aabb' , true  ,
    'abab' , false ,
    'aaa'  , false ,
    'bbb'  , true  ,
);
use Test2::V0 -no_srand => 1; plan @tests/2;
for my ( $str, $expected ) (@tests) {
    is task2($str), $expected;
}