X-Git-Url: http://git.ieval.ro/?p=gruntmaster-daemon.git;a=blobdiff_plain;f=lib%2FGruntmaster%2FDaemon%2FRunner%2FFile.pm;h=55afd70e1560e860d3d8f0a479c882de790e2a24;hp=9193861378142c22b2e809ed22e2054b87db344f;hb=0005d3ad0aba39600e7dbb70c040c416f34985ac;hpb=c020b922b2b04878b04b8d7e84079087f1dc2abc diff --git a/lib/Gruntmaster/Daemon/Runner/File.pm b/lib/Gruntmaster/Daemon/Runner/File.pm index 9193861..55afd70 100644 --- a/lib/Gruntmaster/Daemon/Runner/File.pm +++ b/lib/Gruntmaster/Daemon/Runner/File.pm @@ -21,8 +21,7 @@ sub run{ if (exists $meta->{okfile}) { $ok = $meta->{okfile}[$test - 1] } else { - my $ct = defined $Gruntmaster::Data::contest ? "ct/$Gruntmaster::Data::contest" : ''; - $ok = slurp "/var/lib/gruntmasterd/$ct/pb/$meta->{problem}/$test.ok" + $ok = slurp "/var/lib/gruntmasterd/pb/$meta->{problem}/$test.ok" } $out =~ s/^\s+//; @@ -48,11 +47,16 @@ Gruntmaster::Daemon::Runner::File - Compare output with static text files =head1 SYNOPSIS use Gruntmaster::Daemon::Runner::File; - Gruntmaster::Daemon::Runner::File->run(5, $meta); + Gruntmaster::Daemon::Runner::File::run(5, $meta); =head1 DESCRIPTION -Gruntmaster::Daemon::Runner::File is a runner which compares the program output for test C<$test> with C<< $meta->{tests}[$test - 1] >>. Before comparing, leading and trailing whitespace is removed, and sequences of whitespace are converted to a single space. +Gruntmaster::Daemon::Runner::File is a runner which compares the program output for test C<$test> with a static output. Before comparing, leading and trailing whitespace is removed, and sequences of whitespace are converted to a single space. + +If C<< $meta->{okfile} >> exists, the output is compared to C<< $meta->{okfile}[$test - 1] >>. +Otherwise, the output is compared to F<< /var/lib/gruntmasterd/pb/$meta->{problem}/$test.ok >>. + +If the two strings match, the verdict is C<< $meta->{tests}[$test - 1] >>. Otherwise, the verdict is C<[WA, "Wrong answer"]>. =head1 AUTHOR