Skip to content

Instantly share code, notes, and snippets.

@worldmind
Created June 30, 2016 13:13
Show Gist options
  • Save worldmind/70ad0f0a6d52949f4b0932b77bbd13d4 to your computer and use it in GitHub Desktop.
Save worldmind/70ad0f0a6d52949f4b0932b77bbd13d4 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
use strict;
use Test::More tests => 7;
BEGIN {
use_ok('Class::Date', 'date');
}
my $dt0 = date '2016-06-30 12:00';
my $dt1 = date '2016-06-30 12:00';
my $dt2 = date '2016-06-30 12:12';
my $dt3 = date '2016-06-30 12:22';
my $duration = $dt2 - $dt1;
ok($dt0 == $dt1, '==');
ok($dt2 > $dt1, '>');
ok($dt1 < $dt2, '<');
ok($dt2 - $dt1 == $duration, '== duration');
ok($dt3 - $dt1 > $duration, '> duration');
ok($dt2 - $duration == $dt1, 'anti duration');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment