diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-09-23 12:07:55 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-09-23 12:12:02 -0700 |
commit | bf86f7f39d8e5c4d29068cd665a7b4bafd52f283 (patch) | |
tree | 7f9d83cd41cd5adc88868bf99b36927aafbf80e5 /subx/apps/factorial.subx | |
parent | d48cfd0f36e21f6515285157b785a302932ed675 (diff) | |
download | mu-bf86f7f39d8e5c4d29068cd665a7b4bafd52f283.tar.gz |
4506
check_ints_equal now prints a newline after the failure message on failure. We still don't know how to print a final newline after all the tests have run, for the common case when all tests pass. Ideally I could just emit a few instructions to `run_tests`. But I'd also need to add a variable for the newline to the data segment. Or I need some literal syntax for newlines in strings. We don't have support for backslash-escapes yet.
Diffstat (limited to 'subx/apps/factorial.subx')
-rw-r--r-- | subx/apps/factorial.subx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/subx/apps/factorial.subx b/subx/apps/factorial.subx index 36bc90f8..88f4baa8 100644 --- a/subx/apps/factorial.subx +++ b/subx/apps/factorial.subx @@ -131,6 +131,13 @@ $check_ints_equal:else: e8/call write_stderr/disp32 # discard arg 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP + # print newline + # push args + 68/push Newline/imm32 + # call + e8/call write_stderr/disp32 + # discard arg + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP # end c3/return @@ -196,6 +203,12 @@ write_stderr: # s : (address array byte) -> <void> c3/return == data +Newline: + # size + 01 00 00 00 + # data + 0a/newline + Test_argv: # null-terminated # data 74/t 65/e 73/s 74/t 00/null |