#!/usr/bin/env perl use strict; use warnings; use FindBin; use lib $FindBin::Bin;{{#lib_comment}} {{&lib_comment}}{{/lib_comment}}{{#cdata}} use JSON::PP;{{/cdata}}{{#modules}} use {{&use}};{{/modules}} my $exercise{{#exercise}} = '{{&exercise}}'{{/exercise}};{{#exercise_comment}} {{&exercise_comment}}{{/exercise_comment}} my $test_version{{#version}} = {{&version}}{{/version}};{{#version_comment}} {{&version_comment}}{{/version_comment}} use Test::More{{#plan}} tests => {{&plan}}{{/plan}};{{#plan_comment}} {{&plan_comment}}{{/plan_comment}} use_ok $exercise or BAIL_OUT;{{#use_test_comment}} {{&use_test_comment}}{{/use_test_comment}} {{#version_test_comment}} {{&version_test_comment}}{{/version_test_comment}} my $exercise_version = $exercise->VERSION // 0; if ($exercise_version != $test_version) { warn "\nExercise version mismatch. Further tests may fail!" . "\n$exercise is v$exercise_version. " . "Test is v$test_version.\n"; BAIL_OUT if $ENV{EXERCISM}; } {{#subs}} my %subs; foreach ( qw({{&subs}}) ) { can_ok $exercise, $_; $subs{$_} = $exercise->can($_); } {{/subs}}{{#cdata}} my $C_DATA = do { local $/; decode_json(); };{{/cdata}} {{&tests}} {{#cdata}} __DATA__ {{&json}} {{/cdata}}