From 282681c729857026e3713d45e9027fdfccda0880 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 31 Aug 2019 23:22:49 -0700 Subject: 5600 --- apps/tests.subx | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'apps/tests.subx') diff --git a/apps/tests.subx b/apps/tests.subx index 99b02664..8f825a3a 100644 --- a/apps/tests.subx +++ b/apps/tests.subx @@ -9,8 +9,12 @@ # . op subop mod rm32 base index scale r32 # . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes -Entry: - # Heap = new-segment(Heap-size) +Entry: # run tests if necessary, convert stdin if not + # . prolog + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + + # initialize heap + # . Heap = new-segment(Heap-size) # . . push args 68/push Heap/imm32 68/push Heap-size/imm32 @@ -26,15 +30,12 @@ Entry: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # run tests if necessary, convert stdin if not - # . prolog - 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # initialize heap # - if argc > 1 and argv[1] == "test", then return run_tests() - # . argc > 1 + # if (argc <= 1) goto run-main 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0/disp8 1/imm32 # compare *ebp 7e/jump-if-lesser-or-equal $run-main/disp8 - # . argv[1] == "test" + # if (!kernel-string-equal?(argv[1], "test")) goto run-main + # . eax = kernel-string-equal?(argv[1], "test") # . . push args 68/push "test"/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) @@ -42,11 +43,12 @@ Entry: e8/call kernel-string-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . check result - 3d/compare-eax-and 1/imm32 - 75/jump-if-not-equal $run-main/disp8 - # . run-tests() + # . if (eax == 0) goto run-main + 3d/compare-eax-and 0/imm32 + 74/jump-if-equal $run-main/disp8 + # run-tests() e8/call run-tests/disp32 + # return *Num-test-failures 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $main:end/disp8 $run-main: -- cgit 1.4.1-2-gfad0 05faad9768bd723df1ade114b2bfbd22196'>plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
void append_to_empty(void **state);
void append_wide_to_empty(void **state);
void append_to_single(void **state);
void append_wide_to_single_non_wide(void **state);
void append_non_wide_to_single_wide(void **state);
void append_wide_to_single_wide(void **state);
void append_non_wide_when_overrun(void **state);

void insert_non_wide_to_non_wide(void **state);
void insert_single_non_wide_when_pad_scrolled(void **state);
void insert_many_non_wide_when_pad_scrolled(void **state);
void insert_single_non_wide_last_column(void **state);
void insert_many_non_wide_last_column(void **state);

void ctrl_left_when_no_input(void **state);
void ctrl_left_when_at_start(void **state);
void ctrl_left_when_in_first_word(void **state);
void ctrl_left_when_in_first_space(void **state);
void ctrl_left_when_at_start_of_second_word(void **state);
void ctrl_left_when_in_second_word(void **state);
void ctrl_left_when_at_end_of_second_word(void **state);
void ctrl_left_when_in_second_space(void **state);
void ctrl_left_when_at_start_of_third_word(void **state);
void ctrl_left_when_in_third_word(void **state);
void ctrl_left_when_at_end_of_third_word(void **state);
void ctrl_left_when_in_third_space(void **state);
void ctrl_left_when_at_end(void **state);
void ctrl_left_when_in_only_whitespace(void **state);
void ctrl_left_when_start_whitespace_start_of_word(void **state);
void ctrl_left_when_start_whitespace_middle_of_word(void **state);
void ctrl_left_in_whitespace_between_words(void **state);
void ctrl_left_in_whitespace_between_words_start_of_word(void **state);
void ctrl_left_in_whitespace_between_words_middle_of_word(void **state);
void ctrl_left_when_word_overrun_to_left(void **state);

void ctrl_right_when_no_input(void **state);
void ctrl_right_when_at_end(void **state);
void ctrl_right_one_word_at_start(void **state);
void ctrl_right_one_word_in_middle(void **state);
void ctrl_right_one_word_at_end(void **state);
void ctrl_right_two_words_from_middle_first(void **state);
void ctrl_right_two_words_from_end_first(void **state);
void ctrl_right_two_words_from_space(void **state);
void ctrl_right_two_words_from_start_second(void **state);
void ctrl_right_one_word_leading_whitespace(void **state);
void ctrl_right_two_words_in_whitespace(void **state);
void ctrl_right_trailing_whitespace_from_middle(void **state);