diff --git a/126write-int-decimal.subx b/126write-int-decimal.subx index f2754fda..d30cb762 100644 --- a/126write-int-decimal.subx +++ b/126write-int-decimal.subx @@ -263,6 +263,37 @@ test-write-int32-decimal-negative: # . end c3/return +# There's a special bit pattern that corresponds to no 2's complement integer. +# There doesn't seem to be a widespread convention for representing it. +test-write-int32-decimal-indefinite-integer: + # setup + # . clear-stream(_test-stream) + # . . push args + 68/push _test-stream/imm32 + # . . call + e8/call clear-stream/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp + # write-int32-decimal(_test-stream, 0x80000000) + # . . push args + 68/push 0x80000000/imm32 + 68/push _test-stream/imm32 + # . . call + e8/call write-int32-decimal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + # check-stream-equal(_test-stream, "-(", msg) + # . . push args + 68/push "F - test-write-int32-decimal-indefinite-integer"/imm32 + 68/push "-("/imm32 + 68/push _test-stream/imm32 + # . . call + e8/call check-stream-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp + # . end + c3/return + test-write-int32-decimal-negative-multiple-digits: # - check that a multi-digit number converts correctly # setup