changing factory size per factory
Before it was one class variable, but ints and messages are not created in equal amounts.
This commit is contained in:
@ -5,7 +5,8 @@ module Parfait
|
||||
|
||||
def setup
|
||||
super
|
||||
@factory = Factory.new Parfait.object_space.get_type_by_class_name(:Integer)
|
||||
type = Parfait.object_space.get_type_by_class_name(:Integer)
|
||||
@factory = Factory.new(type , 40)
|
||||
end
|
||||
def test_ok
|
||||
assert @factory
|
||||
@ -24,14 +25,7 @@ module Parfait
|
||||
assert_equal Parfait::Integer , @factory.get_next_object.class
|
||||
end
|
||||
def test_default_test_page
|
||||
assert_equal 20 , Factory.page_size
|
||||
end
|
||||
def test_default_reserve
|
||||
assert_equal 10 , Factory.reserve_size
|
||||
end
|
||||
def test_set_page
|
||||
assert_equal 10 , Factory.page_size = 10
|
||||
Factory.page_size = 1024
|
||||
assert_equal 40 , @factory.page_size
|
||||
end
|
||||
def test_first_is_reserve
|
||||
@factory.get_next_object
|
||||
@ -45,12 +39,13 @@ module Parfait
|
||||
start = start.next_integer
|
||||
count += 1
|
||||
end
|
||||
assert_equal 11 , count
|
||||
assert_equal 16 , count
|
||||
end
|
||||
class BigFactoryTest < BigParfaitTest
|
||||
def setup
|
||||
super
|
||||
@factory = Factory.new Parfait.object_space.get_type_by_class_name(:Integer)
|
||||
type = Parfait.object_space.get_type_by_class_name(:Integer)
|
||||
@factory = Factory.new(type , 300)
|
||||
end
|
||||
def test_chain_length
|
||||
count = 0
|
||||
@ -59,10 +54,10 @@ module Parfait
|
||||
start = start.next_integer
|
||||
count += 1
|
||||
end
|
||||
assert_equal 1024 - 10 , count
|
||||
assert_equal 300-15 , count
|
||||
end
|
||||
def test_default_page
|
||||
assert_equal 1024 , Factory.page_size
|
||||
def test_page
|
||||
assert_equal 300 , @factory.page_size
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -191,7 +191,7 @@ module Parfait
|
||||
count += 1
|
||||
addr = addr.next_integer
|
||||
end
|
||||
assert_equal 1014, count
|
||||
assert_equal 1009, count
|
||||
end
|
||||
def test_message_count
|
||||
mess = @space.get_next_for(:Message)
|
||||
@ -201,7 +201,7 @@ module Parfait
|
||||
assert mess.locals_used
|
||||
mess = mess.next_message
|
||||
end
|
||||
assert_equal 1014, count
|
||||
assert_equal 285, count
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -37,7 +37,7 @@ module Risc
|
||||
ret = main_ticks(46)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
assert_equal :r3 , ret.register.symbol
|
||||
assert_equal 26012 , @interpreter.get_register(ret.register)
|
||||
assert_equal 40348 , @interpreter.get_register(ret.register)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ module Risc
|
||||
|
||||
def test_simple_collect
|
||||
objects = Collector.collect_space(@linker)
|
||||
assert_equal 601 , objects.length , objects.length.to_s
|
||||
assert_equal 1564 , objects.length , objects.length.to_s
|
||||
end
|
||||
|
||||
def test_collect_all_types
|
||||
@ -55,7 +55,7 @@ module Risc
|
||||
|
||||
def test_simple_collect
|
||||
objects = Collector.collect_space(@linker)
|
||||
assert_equal 2419, objects.length , objects.length.to_s
|
||||
assert_equal 1564, objects.length , objects.length.to_s
|
||||
end
|
||||
|
||||
def test_integer_positions
|
||||
|
@ -55,7 +55,12 @@ module Risc
|
||||
end
|
||||
def test_pc1
|
||||
@interpreter.tick
|
||||
assert_equal 25912 , @interpreter.pc
|
||||
assert_equal 40296 , @interpreter.pc
|
||||
end
|
||||
def test_pc2
|
||||
@interpreter.tick
|
||||
@interpreter.tick
|
||||
assert_equal 40300 , @interpreter.pc
|
||||
end
|
||||
def test_tick2
|
||||
@interpreter.tick
|
||||
@ -66,11 +71,6 @@ module Risc
|
||||
@interpreter.tick
|
||||
assert_equal 3 , @interpreter.clock
|
||||
end
|
||||
def test_pc2
|
||||
@interpreter.tick
|
||||
@interpreter.tick
|
||||
assert_equal 25916 , @interpreter.pc
|
||||
end
|
||||
def ttest_tick_14_jump
|
||||
30.times { @interpreter.tick ;puts @interpreter.instruction.class}
|
||||
assert_equal Branch , @interpreter.instruction.class
|
||||
|
@ -25,7 +25,7 @@ module Risc
|
||||
assert_equal 0 , Position.get(@linker.cpu_init).at
|
||||
end
|
||||
def test_cpu_at
|
||||
assert_equal "0x5dbc" , Position.get(@linker.cpu_init.first).to_s
|
||||
assert_equal "0x9e5c" , Position.get(@linker.cpu_init.first).to_s
|
||||
end
|
||||
def test_cpu_label
|
||||
assert_equal Position , Position.get(@linker.cpu_init.first).class
|
||||
|
@ -1,17 +1,20 @@
|
||||
module Parfait
|
||||
def self.default_test_options
|
||||
{
|
||||
factory: 20,
|
||||
Message: 30,
|
||||
Integer: 30,
|
||||
}
|
||||
end
|
||||
def self.interpreter_test_options
|
||||
{
|
||||
factory: 50,
|
||||
Message: 50,
|
||||
Integer: 50,
|
||||
}
|
||||
end
|
||||
def self.full_test_options
|
||||
{
|
||||
factory: 1024,
|
||||
Message: 300,
|
||||
Integer: 300,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user