Sha256: 9ac7d199cc41a67bd13ceae39701fb4b869e9b75e9b7c07f87e52830cd3aa78a
Contents?: true
Size: 1.23 KB
Versions: 7
Compression:
Stored size: 1.23 KB
Contents
#!/usr/bin/env ruby require File.expand_path(File.join(File.dirname(__FILE__), "common")) module FloatTest def test_num_bytes @obj.num_bytes.must_equal 4 end def test_writing_then_reading @obj.value_read_from_written.must_be_close_to Math::PI, 0.000001 end end module DoubleTest def test_num_bytes @obj.num_bytes.must_equal 8 end def test_writing_then_reading @obj.value_read_from_written.must_be_close_to Math::PI, 0.0000000000000001 end end describe "A FloatLe" do include FloatTest before do @obj = BinData::FloatLe.new(Math::PI) end it "#to_binary_s" do @obj.to_binary_s.must_equal [Math::PI].pack('e') end end describe "A FloatBe" do include FloatTest before do @obj = BinData::FloatBe.new(Math::PI) end it "#to_binary_s" do @obj.to_binary_s.must_equal [Math::PI].pack('g') end end describe "A DoubleLe" do include DoubleTest before do @obj = BinData::DoubleLe.new(Math::PI) end it "#to_binary_s" do @obj.to_binary_s.must_equal [Math::PI].pack('E') end end describe "A DoubleBe" do include DoubleTest before do @obj = BinData::DoubleBe.new(Math::PI) end it "#to_binary_s" do @obj.to_binary_s.must_equal [Math::PI].pack('G') end end
Version data entries
7 entries across 7 versions & 1 rubygems