69 |
assert(!slot.is_queue_slot?) |
assert(!slot.is_queue_slot?) |
70 |
assert(!slot.is_stack_slot?) |
assert(!slot.is_stack_slot?) |
71 |
assert(!slot.is_proc_slot?) |
assert(!slot.is_proc_slot?) |
72 |
assert(!slot.is_hash_slot?) |
assert(!slot.is_map_slot?) |
73 |
assert_equal(1, slot.data) |
assert_equal(1, slot.data) |
74 |
assert_exception(RuntimeError) {slot.proc} |
assert_exception(RuntimeError) {slot.proc} |
75 |
assert_exception(RuntimeError) {slot.queue} |
assert_exception(RuntimeError) {slot.queue} |
76 |
assert_exception(RuntimeError) {slot.stack} |
assert_exception(RuntimeError) {slot.stack} |
77 |
assert_exception(RuntimeError) {slot.hash} |
assert_exception(RuntimeError) {slot.map} |
78 |
assert_exception(RuntimeError) {slot.set_proc {|param| return param} } |
assert_exception(RuntimeError) {slot.set_proc {|param| return param} } |
79 |
assert_exception(RuntimeError) {slot.call(2) } |
assert_exception(RuntimeError) {slot.call(2) } |
80 |
assert_exception(RuntimeError) {slot << 1} |
assert_exception(RuntimeError) {slot << 1} |
94 |
assert(!slot.is_data_slot?) |
assert(!slot.is_data_slot?) |
95 |
assert(!slot.is_stack_slot?) |
assert(!slot.is_stack_slot?) |
96 |
assert(!slot.is_proc_slot?) |
assert(!slot.is_proc_slot?) |
97 |
assert(!slot.is_hash_slot?) |
assert(!slot.is_map_slot?) |
98 |
slot.join(2) |
slot.join(2) |
99 |
assert_equal(2, slot.count) |
assert_equal(2, slot.count) |
100 |
assert_equal(1, slot.leave) |
assert_equal(1, slot.leave) |
103 |
assert_exception(RuntimeError) {slot.proc} |
assert_exception(RuntimeError) {slot.proc} |
104 |
assert_exception(RuntimeError) {slot.data} |
assert_exception(RuntimeError) {slot.data} |
105 |
assert_exception(RuntimeError) {slot.stack} |
assert_exception(RuntimeError) {slot.stack} |
106 |
assert_exception(RuntimeError) {slot.hash} |
assert_exception(RuntimeError) {slot.map} |
107 |
assert_exception(RuntimeError) {slot.call(2) } |
assert_exception(RuntimeError) {slot.call(2) } |
108 |
assert_exception(RuntimeError) {slot.set_proc {|param| return param} } |
assert_exception(RuntimeError) {slot.set_proc {|param| return param} } |
109 |
assert_exception(RuntimeError) {slot.push(1)} |
assert_exception(RuntimeError) {slot.push(1)} |
120 |
assert(!slot.is_queue_slot?) |
assert(!slot.is_queue_slot?) |
121 |
assert(!slot.is_data_slot?) |
assert(!slot.is_data_slot?) |
122 |
assert(!slot.is_proc_slot?) |
assert(!slot.is_proc_slot?) |
123 |
assert(!slot.is_hash_slot?) |
assert(!slot.is_map_slot?) |
124 |
slot.push 2 |
slot.push 2 |
125 |
assert_equal(2, slot.count) |
assert_equal(2, slot.count) |
126 |
assert_equal(2, slot.pop) |
assert_equal(2, slot.pop) |
129 |
assert_exception(RuntimeError) {slot.proc} |
assert_exception(RuntimeError) {slot.proc} |
130 |
assert_exception(RuntimeError) {slot.data} |
assert_exception(RuntimeError) {slot.data} |
131 |
assert_exception(RuntimeError) {slot.queue} |
assert_exception(RuntimeError) {slot.queue} |
132 |
assert_exception(RuntimeError) {slot.hash} |
assert_exception(RuntimeError) {slot.map} |
133 |
assert_exception(RuntimeError) {slot.set_proc {|param| return param} } |
assert_exception(RuntimeError) {slot.set_proc {|param| return param} } |
134 |
assert_exception(RuntimeError) {slot.call(2) } |
assert_exception(RuntimeError) {slot.call(2) } |
135 |
assert_exception(RuntimeError) {slot << 1} |
assert_exception(RuntimeError) {slot << 1} |
147 |
assert(!slot.is_stack_slot?) |
assert(!slot.is_stack_slot?) |
148 |
assert(!slot.is_queue_slot?) |
assert(!slot.is_queue_slot?) |
149 |
assert(!slot.is_data_slot?) |
assert(!slot.is_data_slot?) |
150 |
assert(!slot.is_hash_slot?) |
assert(!slot.is_map_slot?) |
151 |
slot.call(4) |
slot.call(4) |
152 |
slot.proc.call(4) |
slot.proc.call(4) |
153 |
assert_exception(RuntimeError) {slot.stack} |
assert_exception(RuntimeError) {slot.stack} |
154 |
assert_exception(RuntimeError) {slot.data} |
assert_exception(RuntimeError) {slot.data} |
155 |
assert_exception(RuntimeError) {slot.queue} |
assert_exception(RuntimeError) {slot.queue} |
156 |
assert_exception(RuntimeError) {slot.hash} |
assert_exception(RuntimeError) {slot.map} |
157 |
assert_exception(RuntimeError) {slot << 1} |
assert_exception(RuntimeError) {slot << 1} |
158 |
assert_exception(RuntimeError) {slot.join(1)} |
assert_exception(RuntimeError) {slot.join(1)} |
159 |
assert_exception(RuntimeError) {slot.leave} |
assert_exception(RuntimeError) {slot.leave} |
163 |
assert_exception(RuntimeError) {slot.get(1)} |
assert_exception(RuntimeError) {slot.get(1)} |
164 |
end |
end |
165 |
|
|
166 |
def test_7_slottype_hash |
def test_7_slottype_map |
167 |
bus = FreeBASE::DataBus.new |
bus = FreeBASE::DataBus.new |
168 |
slot = bus["slot"] |
slot = bus["slot"] |
169 |
slot.put(1,2) |
slot.put(1,2) |
170 |
assert(slot.is_hash_slot?) |
assert(slot.is_map_slot?) |
171 |
assert(!slot.is_stack_slot?) |
assert(!slot.is_stack_slot?) |
172 |
assert(!slot.is_queue_slot?) |
assert(!slot.is_queue_slot?) |
173 |
assert(!slot.is_data_slot?) |
assert(!slot.is_data_slot?) |
176 |
assert_equal(1, slot.count) |
assert_equal(1, slot.count) |
177 |
slot.clear |
slot.clear |
178 |
assert_equal(0, slot.count) |
assert_equal(0, slot.count) |
179 |
slot.hash.set_hash(1=>2, 2=>3) |
slot.map.map= {1=>2, 2=>3} |
180 |
assert_equal(2, slot.get(1)) |
assert_equal(2, slot.get(1)) |
181 |
assert_equal(3, slot.get(2)) |
assert_equal(3, slot.get(2)) |
182 |
assert_exception(RuntimeError) {slot.proc} |
assert_exception(RuntimeError) {slot.proc} |