rubyx/test/parfait/test_data_object.rb
Torsten Ruger e86ca5ae9d integer was wrong padded§ length
or rather right (2 as should be and will be)
but currently we use next AND value + type means 3, rounded 4
because we can’t swap types at compile time (as is planned at runtime,
we use next OR value)
2018-05-30 14:55:17 +03:00

47 lines
1.1 KiB
Ruby

require_relative "helper"
module Parfait
class TestClass < ParfaitTest
def test_data_class_api_base
assert_raises {DataObject.type_length}
end
def test_data_class_api4
assert_equal 4 , Data4.memory_size
end
def test_data_class_api8
assert_equal 8 , Data8.memory_size
end
def test_data_class_api16
assert_equal 16 , Data16.memory_size
end
def test_data_class_api32
assert_equal 32 , Data32.memory_size
end
def test_int_len
assert_equal 4 , Integer.new(1).data_length
end
def test_true_len
assert_equal 4 , TrueClass.new.data_length
end
def test_false_len
assert_equal 4 , FalseClass.new.data_length
end
def test_nil_len
assert_equal 4 , NilClass.new.data_length
end
def test_int_pad
assert_equal 16 , Integer.new(2).padded_length
end
def test_true_pad
assert_equal 16 , TrueClass.new.padded_length
end
def test_false_pad
assert_equal 16 , FalseClass.new.padded_length
end
def test_nil_pad
assert_equal 16 , NilClass.new.padded_length
end
end
end