diff --git a/lib/slot_machine/macro/comparison.rb b/lib/slot_machine/macro/comparison.rb index 7b387824..f5297feb 100644 --- a/lib/slot_machine/macro/comparison.rb +++ b/lib/slot_machine/macro/comparison.rb @@ -32,7 +32,7 @@ module SlotMachine left.op :- , right end if_minus false_label - if_not_zero( false_label ) if operator.to_s.length == 1 + if_zero( false_label ) if operator.to_s.length == 1 add_code Risc::LoadConstant.new(to_s , Parfait.object_space.true_object, result) branch merge_label add_code false_label diff --git a/test/risc/interpreter/builtin/test_int_cmp.rb b/test/risc/interpreter/builtin/test_int_cmp.rb index 732b4abd..2adbf11f 100644 --- a/test/risc/interpreter/builtin/test_int_cmp.rb +++ b/test/risc/interpreter/builtin/test_int_cmp.rb @@ -32,7 +32,6 @@ module Risc run_main_return "5 > 5" assert_equal Parfait::FalseClass , get_message_return.class end - def test_smaller_or_true run_main_return "4 <= 5" assert_equal Parfait::TrueClass , get_message_return.class diff --git a/test/slot_machine/macro/test_comparison.rb b/test/slot_machine/macro/test_comparison.rb index 1296fc59..0fb4b496 100644 --- a/test/slot_machine/macro/test_comparison.rb +++ b/test/slot_machine/macro/test_comparison.rb @@ -38,7 +38,7 @@ module SlotMachine assert_slot_to_reg 4 , "message.arg1" , 2 , "message.arg1.data_1" assert_operator 5 , :- , "message.receiver.data_1" , "message.arg1.data_1" ,"op_-_" assert_minus 6 , "false_label_" - assert_not_zero 7 , "false_label_" + assert_zero 7 , "false_label_" assert_load 8 , Parfait::TrueClass , :result assert_branch 9 , "merge_label_" assert_label 10 , "false_label_"