1 # $Id: test_basic.rb 1 2005-03-26 01:45:38Z tilman $
12 @long_long = (2 << 63) - 1
25 "i16" => [@short, :short],
27 "i64" => [@long_long, :long_long],
30 "f64" => [@double, :double]}
34 class BasicTest < Test::Unit::TestCase
36 data = BasicTestData.new.to_eet
41 assert_nothing_raised do
42 stream = Eet::Stream.deserialize(data)
45 assert_equal(1, stream.length)
46 assert_equal("BasicTest", stream.first.tag)
48 assert_nothing_raised do
49 stream = Eet::Stream.deserialize(stream.first.data)
52 assert_equal(7, stream.length)
54 values = {"name" => "moo\0",
55 "i16" => "\0\2", "i32" => "\0\4\0\0",
56 "i64" => "\377" * 8, "flag" => "\1",
57 "f32" => "1234." + ("0" * 16) + "\0",
58 "f64" => "12341234." + ("0" * 32) + "\0"}
60 found = stream.find { |c| c.tag == k }
61 assert_not_nil(found, "chunk not found - #{k}")
62 assert_equal(v, found.data)
66 assert_equal([], stream)