aboutsummaryrefslogtreecommitdiff
path: root/challenge-286/ppentchev/tests/04-python-ch-2.t
blob: 1d36b91a8524e05fd5b597f1caede257c47fab07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl
# SPDX-FileCopyrightText: Peter Pentchev <roam@ringlet.net>
# SPDX-License-Identifier: BSD-2-Clause

use v5.16;
use strict;
use warnings;

use Test::More;

use lib 'tests/lib';

use PWCTest::Ch286 qw(
	find_python3
	test_order_game
	test_order_game_count
	test_order_game_default
);

my $py3;
BEGIN {
	$py3 = find_python3;
}

if (!defined $py3) {
	plan skip_all => 'no Python 3 interpreter found';
	exit 0;
}

plan tests => 2;

use constant PROG => 'python/scripts/ch-2.py';

my $py3_prog = [$py3, '-B', '-u', '--', PROG];

subtest order_game_default => sub {
	test_order_game_default $py3_prog;
};

subtest order_game => sub {
    plan tests => test_order_game_count;
    for my $idx (1..test_order_game_count) {
        subtest "run $idx" => sub {
            test_order_game $py3_prog, $idx - 1;
        };
    }
};