add fiber tests

parent 76ddf86c
assert('Fiber.new') {
f = Fiber.new{}
f.class == Fiber
}
assert('Fiber#resume') {
f = Fiber.new{|x| x == 2}
f.resume(2)
}
assert('Fiber.yield') {
f = Fiber.new{|x| Fiber.yield(x == 3)}
f.resume(3)
}
assert('Fiber iteration') {
f1 = Fiber.new{
[1,2,3].each{|x| Fiber.yield(x)}
}
f2 = Fiber.new{
[9,8,7].each{|x| Fiber.yield(x)}
}
a = []
3.times {
a << f1.resume
a << f2.resume
}
a == [1,9,2,8,3,7]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment