summaryrefslogtreecommitdiff
path: root/bucky2/t/when.pl
diff options
context:
space:
mode:
Diffstat (limited to 'bucky2/t/when.pl')
-rwxr-xr-xbucky2/t/when.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/bucky2/t/when.pl b/bucky2/t/when.pl
new file mode 100755
index 0000000..4e13427
--- /dev/null
+++ b/bucky2/t/when.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+use lib "../lib";
+use Common;
+
+my $rules_x = [ qw[ 5 10 30 60 75 125 210 300 600 1250 3600 ] ];
+my $rules_y = [ 1, (60*60*24), (50), (50) ];
+my $tasks = [ time ];
+my $y_oper = 1;
+for my $y (@$rules_y)
+ {
+ $y_oper *= $y;
+ for my $x (@$rules_x)
+ {
+# print "$x\t$y_oper\t" . int($x * $y_oper) . " " . ( time - int( $x * $y_oper) ). "\n";
+ push @$tasks, (time - int( $x * $y_oper ));
+ }
+ }
+run_tasks($tasks);
+
+sub run_tasks
+ {
+ my ($tasks) = @_;
+ for my $task (@$tasks)
+ {
+ print $task . "\t-- ";
+ print test($task) . "\t";
+# print expected($task) . "\n";
+ print control($task) . "\n";
+ }
+ }
+sub test
+ { my ($task) = @_; return Common->get_age($task); }
+sub control
+ { my ($task) = @_; return Common->show_date($task); }
+#sub _load_expected
+# { my ($self, $task, $expected) = @_; $self->{'expected'} ||= {}; $self->{'expected'}->{$task} = $expected; }
+1;