2015-06-04 07:22:38 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
class Padded
|
|
|
|
include Padding
|
|
|
|
end
|
|
|
|
|
|
|
|
class TestPadding < MiniTest::Test
|
|
|
|
|
|
|
|
def setup
|
|
|
|
@pad = Padded.new
|
|
|
|
end
|
|
|
|
def test_small
|
|
|
|
[6,20,23,24].each do |p|
|
|
|
|
assert_equal 32 , @pad.padded(p) , "Expecting 32 for #{p}"
|
|
|
|
end
|
|
|
|
end
|
2015-06-28 09:50:47 +02:00
|
|
|
def test_medium
|
2015-06-04 07:22:38 +02:00
|
|
|
[26,40,53,56].each do |p|
|
|
|
|
assert_equal 64 , @pad.padded(p) , "Expecting 64 for #{p}"
|
|
|
|
end
|
|
|
|
end
|
2015-06-28 09:50:47 +02:00
|
|
|
def test_large
|
|
|
|
[58,88].each do |p|
|
|
|
|
assert_equal 96 , @pad.padded(p) , "Expecting 96 for #{p}"
|
|
|
|
end
|
|
|
|
end
|
2015-06-04 07:22:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
class TestPositioning < MiniTest::Test
|
|
|
|
def test_list1
|
|
|
|
list = Virtual.new_list([1])
|
2015-06-28 09:50:47 +02:00
|
|
|
list.set_layout( Parfait::Layout.new Object)
|
2015-06-05 08:20:43 +02:00
|
|
|
assert_equal 32 , list.word_length
|
2015-06-04 07:22:38 +02:00
|
|
|
end
|
|
|
|
def test_list5
|
|
|
|
list = Virtual.new_list([1,2,3,4,5])
|
2015-06-28 09:50:47 +02:00
|
|
|
list.set_layout( Parfait::Layout.new Object)
|
2015-06-05 08:20:43 +02:00
|
|
|
assert_equal 32 , list.word_length
|
2015-06-04 07:22:38 +02:00
|
|
|
end
|
|
|
|
def test_layout
|
|
|
|
layout = Parfait::Layout.new Object
|
2015-06-28 09:50:47 +02:00
|
|
|
layout.set_layout( Parfait::Layout.new Object)
|
2015-06-04 07:22:38 +02:00
|
|
|
layout.push 5
|
2015-06-05 08:20:43 +02:00
|
|
|
assert_equal 32 , layout.word_length
|
2015-06-04 07:22:38 +02:00
|
|
|
end
|
|
|
|
end
|