Sha256: fe7d47fcf3e75ba7441d478004fe864f17317e650ffbafe62f62911db82d6656
Contents?: true
Size: 1.49 KB
Versions: 20
Compression:
Stored size: 1.49 KB
Contents
use warnings; use strict; use Test::More tests => 9; my $module = $ENV{EXERCISM} ? 'Example' : 'GradeSchool'; use_ok($module) or BAIL_OUT "You need to create a module called $module.pm"; sub new_school { no strict 'refs'; $module->new(); }; is_deeply new_school, {}, 'empty school'; for (1) { my $school = new_school; $school->add('Aimee', 2); is_deeply $school, {2 => ['Aimee']}, 'add student'; } for (1) { my $school = new_school; $school->add($_, 2) for qw(Blair James Paul); is_deeply $school, {2 => ['Blair', 'James', 'Paul']}, 'add more students'; } for (1) { my $school = new_school; $school->add('Chelsea', 3); $school->add('Logan', 7); is_deeply $school, { 3 => ['Chelsea'], 7 => ['Logan'] }, 'add students to different grades'; } for (1) { my $school = new_school; $school->add($_, 5) for 'Bradley', 'Franklin'; $school->add('Jeff', 1); is_deeply $school->grade(5), ['Bradley', 'Franklin'], 'get students in a grade'; } for (1) { my $school = new_school; $school->add($_, 5) for 'Franklin', 'Bradley'; $school->add('Jeff', 1); is_deeply $school->grade(5), ['Bradley', 'Franklin'], 'get students sorted in a grade'; } is_deeply new_school->grade(1), [], 'get students in a non-existant grade'; for (1) { my $school = new_school; $school->add('Jennifer', 4); $school->add('Kareem', 6); $school->add('Christopher', 4); $school->add('Kyle', 3); is_deeply $school, { 3 => ['Kyle'], 4 => ['Christopher', 'Jennifer'], 6 => ['Kareem'] }, 'sort school'; }
Version data entries
20 entries across 20 versions & 1 rubygems