]>
iEval git - gruntmaster-data.git/blob - t/Gruntmaster-Data.t
4 use Test
::More tests
=> 13;
6 BEGIN { use_ok
('Gruntmaster::Data') };
8 my $db = Gruntmaster
::Data
->connect('dbi:SQLite:dbname=:memory:');
11 $db->users->create({id
=> 'MGV'});
12 $db->contests->create({id
=> 'fc', start
=> 10, stop
=> 20, name
=> 'Finished contest', owner
=> 'MGV'});
13 $db->contests->create({id
=> 'rc', start
=> 20, stop
=> 30, name
=> 'Running contest', owner
=> 'MGV'});
14 $db->contests->create({id
=> 'pc', start
=> 30, stop
=> 40, name
=> 'Pending contest', owner
=> 'MGV'});
16 ok
$db->contest('pc')->is_pending(25), 'is_pending';
17 ok
!$db->contest('rc')->is_pending(25), '!is_pending';
18 ok
$db->contest('fc')->is_finished(25), 'is_finished';
19 ok
!$db->contest('rc')->is_finished(25), '!is_finished';
20 ok
$db->contest('rc')->is_running(25), 'is_running';
22 $db->problems->create({id
=> 'pb', name
=> 'Problem', generator
=> 'Undef', runner
=> 'File', judge
=> 'Absolute', level
=> 'beginner', owner
=> 'MGV', statement
=> '...', testcnt
=> 1, timeout
=> 1, private
=> 0});
24 ok
!$db->problem('pb')->is_private(25), '!is_private';
25 $db->problem('pb')->update({private
=> 1});
26 ok
$db->problem('pb')->is_private(25), 'is_private (explicit)';
27 $db->problem('pb')->update({private
=> 0});
29 $db->contest_problems->create({contest
=> 'pc', problem
=> 'pb'});
30 ok
$db->problem('pb')->is_private(25), 'is_private (implicit)';
31 ok
$db->problem('pb')->is_in_archive(25), 'is_in_archive';
33 $db->contest_problems->create({contest
=> 'rc', problem
=> 'pb'});
34 ok
$db->problem('pb')->is_private(25), 'is_private (also implicit)';
35 ok
!$db->problem('pb')->is_in_archive(25), '!is_in_archive';
37 $db->contest_problems->find('rc', 'pb')->delete;
38 ok
$db->problem('pb')->is_in_archive(25), 'is_in_archive (again)';
This page took 0.05641 seconds and 4 git commands to generate.