Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: de34cf87d1
Fetching contributors…

Cannot retrieve contributors at this time

48 lines (32 sloc) 0.954 kB
#!/usr/bin/ruby
# Created by Jinwoo Baek on 4/01/12.
# Copyright (c) 2012 Jinwoo Baek. All rights reserved.
require 'test/unit/assertions'
require 'Grid'
class TestGrid
include Test::Unit::Assertions
def test_initialize
grid = Grid.new
assert_equal :unoccupied, grid.state
# ----------------------------------------------------------
grid = Grid.new(:occupied)
assert_equal :occupied, grid.state
end
def test_set_state
grid = Grid.new
assert_equal :unoccupied, grid.state
assert_equal true, grid.set_state(:occupied)
assert_equal :occupied, grid.state
end
def test_set_wrong_state
grid = Grid.new
assert_equal :unoccupied, grid.state
assert_equal false, grid.set_state(:blaaa)
assert_equal :unoccupied, grid.state
end
end
# ------------------------------------------------------------------
grid_tester = TestGrid.new
grid_tester.test_initialize
grid_tester.test_set_state
grid_tester.test_set_wrong_state
Jump to Line
Something went wrong with that request. Please try again.