TeensyMud - 'A ruby mud server.'

Browse repository
back

test_gameobject.rb

# Code Generated by ZenTest v. 2.4.0
# classname: asrt / meth = ratio%
# GameObject: 34 / 13 = 261.54%

unless defined? $ZENTEST and $ZENTEST
require 'test/unit'
require 'flexmock'
load 'mockengine.rb'
require 'storage/properties'
require 'core/gameobject'
require 'core/character'
require 'core/room'
end

class TestGameObject < Test::Unit::TestCase

def setup
$id = 0
@r = Room.new("Here",0)
$r = @r
@p = Character.new("Tyche",nil)
$p = @p
@o = GameObject.new("Thing",0)
$o = @o
end

def test_add_contents
assert_equal([17],@o.add_contents(17))
end

def test_add_trigger
assert_equal(99,@o.add_trigger(:describe, 99))
end

def test_contents
assert_equal([],@r.contents)
end

def test_contents_equals
assert_respond_to(@o, :contents=)
end

def test_delete_contents
assert_equal([7],@o.add_contents(7))
assert_equal(7,@o.delete_contents(7))
end

def test_delete_trigger
assert_equal(99,@o.add_trigger(:describe, 99))
assert_equal(99,@o.delete_trigger(:describe))
end

def test_describe
m = FlexMock.new
m.mock_handle(:kind) {:describe}
m.mock_handle(:from) {2}
assert_equal([3],@r.add_contents(3))
assert_equal(1,@o.location=1)
assert(@o.describe(m))
end

def test_drop
m = FlexMock.new
m.mock_handle(:kind) {:drop}
m.mock_handle(:from) {2}
assert_equal([3],@r.add_contents(3))
assert_equal(1,@o.location=1)
assert(@o.drop(m))
end

def test_get
m = FlexMock.new
m.mock_handle(:kind) {:get}
m.mock_handle(:from) {2}
assert_equal([3],@r.add_contents(3))
assert_equal(1,@o.location=1)
assert(@o.get(m))
end

def test_timer
m = FlexMock.new
m.mock_handle(:kind) {:timer}
m.mock_handle(:from) {2}
assert(!@o.timer(m))
end

def test_triggers
assert_respond_to(@o, :triggers)
end

def test_triggers_equals
assert_respond_to(@o, :triggers=)
end

def test_get_contents
assert_equal([7],@o.add_contents(7))
assert_equal([7],@o.get_contents)
end

def test_get_trigger
assert_equal(99,@o.add_trigger(:describe, 99))
assert_equal(99,@o.get_trigger("describe"))
end

def test_get_triggers
assert_equal([],@o.get_triggers)
assert_equal(99,@o.add_trigger(:describe, 99))
assert_equal([99],@o.get_triggers)
end

def test_location
assert_equal(nil,@o.location)
assert_equal(2,@o.location=2)
assert_equal(2,@o.location)
end

def test_location_equals
assert_equal(1,@o.location=1)
end

def test_log
assert_respond_to(@o, :log)
end

def test_objects
assert(@o.objects)
end

def test_id
assert_equal(3,@o.id)
end

def test_parse
m = FlexMock.new
assert_equal(false,@o.parse(m))
end

def test_characters
assert(@o.characters)
end

end