| 1 | package Gruntmaster::Daemon::Generator::File; |
| 2 | |
| 3 | use 5.014000; |
| 4 | use strict; |
| 5 | use warnings; |
| 6 | |
| 7 | use File::Copy qw/copy/; |
| 8 | use File::Slurp qw/write_file/; |
| 9 | use Log::Log4perl qw/get_logger/; |
| 10 | |
| 11 | our $VERSION = "5999.000_002"; |
| 12 | |
| 13 | ################################################## |
| 14 | |
| 15 | sub generate{ |
| 16 | my ($test, $meta) = @_; |
| 17 | get_logger->trace("Generating test $test ..."); |
| 18 | if (exists $meta->{infile}) { |
| 19 | write_file 'input', $meta->{infile}[$test - 1] |
| 20 | } else { |
| 21 | copy "/var/lib/gruntmasterd/pb/$meta->{problem}/$test.in", 'input' |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | 1; |
| 26 | __END__ |
| 27 | |
| 28 | =encoding utf-8 |
| 29 | |
| 30 | =head1 NAME |
| 31 | |
| 32 | Gruntmaster::Daemon::Generator::File - Generate tests from files |
| 33 | |
| 34 | =head1 SYNOPSIS |
| 35 | |
| 36 | use Gruntmaster::Daemon::Generator::File; |
| 37 | Gruntmaster::Daemon::Generator::File->generate(5, $meta); |
| 38 | |
| 39 | =head1 DESCRIPTION |
| 40 | |
| 41 | Gruntmaster::Daemon::Generator::File is a static test generator. Test C<$i> is C<< $meta->{infile}[$i - 1] >>. |
| 42 | |
| 43 | =head1 AUTHOR |
| 44 | |
| 45 | Marius Gavrilescu E<lt>marius@ieval.roE<gt> |
| 46 | |
| 47 | =head1 COPYRIGHT AND LICENSE |
| 48 | |
| 49 | Copyright (C) 2014 by Marius Gavrilescu |
| 50 | |
| 51 | This library is free software: you can redistribute it and/or modify |
| 52 | it under the terms of the GNU Affero General Public License as published by |
| 53 | the Free Software Foundation, either version 3 of the License, or |
| 54 | (at your option) any later version. |
| 55 | |
| 56 | |
| 57 | =cut |