/[freeride]/freeride/test/utest_databus.rb
ViewVC logotype

Diff of /freeride/test/utest_databus.rb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by richkilmer, Tue Feb 5 03:14:47 2002 UTC revision 1.5 by richkilmer, Wed Feb 6 03:34:24 2002 UTC
# Line 1  Line 1 
1  # Purpose: FreeRIDE databus unit test  # Purpose: FreeBASE databus unit test
2  #      #    
3  # $Id$  # $Id$
4  #  #
# Line 15  Line 15 
15  #  #
16    
17  require 'rubyunit'  require 'rubyunit'
18  require 'freeride/databus'  require 'freebase/databus'
19    
20  class Test_DataBus < TestCase  class Test_DataBus < TestCase
21                    
22    def test_1_subscribe    def test_1_subscribe
23      bus = FreeRIDE::DataBus.new      bus = FreeBASE::DataBus.new
24      parentNotified = slotNotified = false      parentNotified = slotNotified = false
25      bus["/"].subscribe do |event, slot|      bus["/"].subscribe do |event, slot|
26        if event == :notify_data_set        if event == :notify_data_set
# Line 54  class Test_DataBus < TestCase Line 54  class Test_DataBus < TestCase
54    end    end
55    
56    def test_2_validate    def test_2_validate
57      bus = FreeRIDE::DataBus.new      bus = FreeBASE::DataBus.new
58      bus["/foo/bar/int"].validate_with("Does not implement to_i") { | value | value.respond_to? "to_i" }      bus["/foo/bar/int"].validate_with("Does not implement to_i") { | value | value.respond_to? "to_i" }
59      bus["/foo/bar/int"].data = 1      bus["/foo/bar/int"].data = 1
60      assert_equal(1, bus["/foo/bar/int"].data)      assert_equal(1, bus["/foo/bar/int"].data)
# Line 62  class Test_DataBus < TestCase Line 62  class Test_DataBus < TestCase
62    end    end
63        
64    def test_3_slottype_data    def test_3_slottype_data
65      bus = FreeRIDE::DataBus.new      bus = FreeBASE::DataBus.new
66      slot = bus["slot"]      slot = bus["slot"]
67      slot.data = 1      slot.data = 1
68      assert(slot.is_data_slot?)      assert(slot.is_data_slot?)
# Line 83  class Test_DataBus < TestCase Line 83  class Test_DataBus < TestCase
83    end    end
84        
85    def test_4_slottype_queue    def test_4_slottype_queue
86      bus = FreeRIDE::DataBus.new      bus = FreeBASE::DataBus.new
87      slot = bus["slot"]      slot = bus["slot"]
88      slot << 1      slot << 1
89      assert(slot.is_queue_slot?)      assert(slot.is_queue_slot?)
# Line 105  class Test_DataBus < TestCase Line 105  class Test_DataBus < TestCase
105    end    end
106        
107    def test_5_slottype_stack    def test_5_slottype_stack
108      bus = FreeRIDE::DataBus.new      bus = FreeBASE::DataBus.new
109      slot = bus["slot"]      slot = bus["slot"]
110      slot.push 1      slot.push 1
111      assert(slot.is_stack_slot?)      assert(slot.is_stack_slot?)
# Line 128  class Test_DataBus < TestCase Line 128  class Test_DataBus < TestCase
128    end    end
129        
130    def test_6_slottype_proc    def test_6_slottype_proc
131      bus = FreeRIDE::DataBus.new      bus = FreeBASE::DataBus.new
132      slot = bus["slot"]      slot = bus["slot"]
133      slot.set_proc { |param| assert_equals(4, param) }      slot.set_proc { |param| assert_equals(4, param) }
134      assert(slot.is_proc_slot?)      assert(slot.is_proc_slot?)
# Line 148  class Test_DataBus < TestCase Line 148  class Test_DataBus < TestCase
148    end    end
149        
150    def test_7_slot_attributes    def test_7_slot_attributes
151      bus = FreeRIDE::DataBus.new      bus = FreeBASE::DataBus.new
152      slot = bus["test/slot"]      slot = bus["test/slot"]
153      slot.attr_test=1      slot.attr_test=1
154      slot.attr_test2=2      slot.attr_test2=2

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26