1 # $Id: test_basic.rb 59 2005-06-08 16:13:15Z tilman $
12 @long_long = (2 << 63) - 1
14 @float = 1234.12424213138
24 "i16" => [@short, :short],
26 "i64" => [@long_long, :long_long],
29 "f64" => [@float, :double]}
33 class BasicTest < Test::Unit::TestCase
35 data = BasicTestData.new.to_eet
40 assert_nothing_raised do
41 stream = Eet::Stream.deserialize(data)
44 assert_equal(1, stream.length)
45 assert_equal("BasicTest", stream.first.tag)
47 assert_nothing_raised do
48 stream = Eet::Stream.deserialize(stream.first.data)
51 assert_equal(7, stream.length)
53 values = {"name" => "moo\0",
54 "i16" => "\0\2", "i32" => "\0\4\0\0",
55 "i64" => "\377" * 8, "flag" => "\1",
56 "f32" => "0x1.3487f4p+10\0",
57 "f64" => "0x1.3487f39544c4p+10\0"}
59 found = stream.find { |c| c.tag == k }
60 assert_not_nil(found, "chunk not found - #{k}")
61 assert_equal(v, found.data)
65 assert_equal([], stream)