41 lines
832 B
Ruby
41 lines
832 B
Ruby
require "minitest/autorun"
|
|
require "printing_department"
|
|
|
|
class TestPrintingDepartment < Minitest::Test
|
|
def test_accessible_rolls
|
|
map = <<END
|
|
..@@.@@@@.
|
|
@@@.@.@.@@
|
|
@@@@@.@.@@
|
|
@.@@@@..@.
|
|
@@.@@@@.@@
|
|
.@@@@@@@.@
|
|
.@.@.@.@@@
|
|
@.@@@.@@@@
|
|
.@@@@@@@@.
|
|
@.@.@@@.@.
|
|
END
|
|
|
|
accessible_rolls_map = <<END
|
|
..xx.xx@x.
|
|
x@@.@.@.@@
|
|
@@@@@.x.@@
|
|
@.@@@@..@.
|
|
x@.@@@@.@x
|
|
.@@@@@@@.@
|
|
.@.@.@.@@@
|
|
x.@@@.@@@@
|
|
.@@@@@@@@.
|
|
x.x.@@@.x.
|
|
END
|
|
|
|
printing_department = PrintingDepartment.for map
|
|
assert_equal(13, printing_department.accessible_rolls.count)
|
|
printing_department.remove_accessible_rolls!
|
|
assert_equal(12, printing_department.accessible_rolls.count)
|
|
printing_department.remove_all_accessible_rolls!
|
|
assert_equal(0, printing_department.accessible_rolls.count)
|
|
assert_equal(43, printing_department.removed_rolls.count)
|
|
end
|
|
end
|