Changeset 193
- Timestamp:
- 11/20/04 01:51:04 (4 years ago)
- Files:
-
- 1 modified
-
branches/simplest-thing/tests/area.tests.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simplest-thing/tests/area.tests.rb
r172 r193 19 19 20 20 require 'fm/area' 21 require 'fm/event' 22 require 'fm/entity' 21 23 22 24 ### Test case for the FaerieMUD::Area class and associated classes/modules. 23 25 class FaerieMUD::AreaTestCase < FaerieMUD::TestCase 26 27 class PingEvent < FaerieMUD::Event; end 28 class PingVerb < FaerieMUD::Verb; end 29 30 class TestLocus < FaerieMUD::Locus 31 def initialize( args={} ) 32 super 33 @pingEchoCount = 0 34 end 35 36 attr_reader :pingEchoCount 37 38 def ping 39 ev = PingEvent::new( 40 :instigator => self, 41 :origin => self, 42 :verb => PingVerb::instance 43 ) 44 self.disperseEvents( ev ) 45 end 46 47 def handlePingEvent( ev ) 48 @pingEchoCount += 1 49 end 50 end 51 24 52 25 53 ################################################################# … … 29 57 ### Instance test 30 58 def test_00_Instance 59 printTestHeader "Area: Instance" 31 60 rval = nil 32 61 … … 41 70 } 42 71 end 43 72 73 74 ### Reflect dispersed events back into the area's contents 75 def test_10_reflect_events 76 printTestHeader "Area: Reflect dispersed events" 77 78 tl = TestLocus::new 79 area = FaerieMUD::Area::new 80 area << tl 81 82 # Ping -- should get an echo back 83 assert_nothing_raised { tl.ping } 84 assert_equal 1, tl.pingEchoCount 85 86 assert_nothing_raised { tl.ping } 87 assert_equal 2, tl.pingEchoCount 88 89 end 44 90 end 45 91
