From 8158578671ea121970bed4a0f5fb8e5be3e4a009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20-rsm-=20Marek?= Date: Wed, 22 May 2024 20:22:57 +0200 Subject: [PATCH] Better tests for Calc. --- .../4_03.calc__modulo_negative/{get_ungetch.c => getch.c} | 4 ++-- .../4_03.calc__modulo_negative/{get_ungetch.h => getch.h} | 5 +++-- .../4_03.calc__modulo_negative/getop.c | 2 +- .../4_03.calc__modulo_negative/main.c | 2 +- .../4_03.calc__modulo_negative/{pop_push.c => stack.c} | 0 .../4_03.calc__modulo_negative/{pop_push.h => stack.h} | 5 +++-- .../tests/00_error_stack_empty.tin | 1 + .../tests/00_error_stack_empty.tout} | 0 .../tests/01_error_unknown_command.tin | 1 + .../tests/01_error_unknown_command.tout | 3 +++ .../tests/02_error_zero_divisor.tin | 1 + .../tests/02_error_zero_divisor.tout | 2 ++ .../tests/03_error_zero_modulus.tin | 1 + .../tests/03_error_zero_modulus.tout | 2 ++ .../4_03.calc__modulo_negative/tests/10_add.tin | 1 + .../4_03.calc__modulo_negative/tests/10_add.tout | 1 + .../4_03.calc__modulo_negative/tests/11_sub.tin | 1 + .../4_03.calc__modulo_negative/tests/11_sub.tout | 1 + .../4_03.calc__modulo_negative/tests/12_sub_negative.tin | 1 + .../4_03.calc__modulo_negative/tests/12_sub_negative.tout | 1 + .../4_03.calc__modulo_negative/tests/13_multi.tin | 1 + .../4_03.calc__modulo_negative/tests/13_multi.tout | 1 + .../4_03.calc__modulo_negative/tests/14_div.tin | 1 + .../tests/{t2.tout => 14_div.tout} | 0 .../4_03.calc__modulo_negative/tests/15_mod.tin | 1 + .../4_03.calc__modulo_negative/tests/15_mod.tout | 1 + .../4_03.calc__modulo_negative/tests/16_many.tin | 1 + .../4_03.calc__modulo_negative/tests/16_many.tout | 1 + .../4_03.calc__modulo_negative/tests/t0.tin | 1 - .../4_03.calc__modulo_negative/tests/t0.tout | 1 - .../4_03.calc__modulo_negative/tests/t1.tin | 1 - .../4_03.calc__modulo_negative/tests/t1.tout | 1 - .../4_03.calc__modulo_negative/tests/t2.tin | 1 - .../4_03.calc__modulo_negative/tests/t3.tin | 1 - .../4_03.calc__modulo_negative/tests/t3.tout | 1 - .../4_03.calc__modulo_negative/tests/t4.tin | 1 - .../4_03.calc__modulo_negative/tests/t4.tout | 1 - .../4_04.calc__stack_cmds/getch.c | 4 ++-- .../4_04.calc__stack_cmds/tests/00_error_stack_empty.tin | 1 + .../4_04.calc__stack_cmds/tests/00_error_stack_empty.tout | 2 ++ .../4_04.calc__stack_cmds/tests/01_error_unknown_command.tin | 1 + .../tests/01_error_unknown_command.tout | 3 +++ .../4_04.calc__stack_cmds/tests/02_error_zero_divisor.tin | 1 + .../4_04.calc__stack_cmds/tests/02_error_zero_divisor.tout | 2 ++ .../4_04.calc__stack_cmds/tests/03_error_zero_modulus.tin | 1 + .../4_04.calc__stack_cmds/tests/03_error_zero_modulus.tout | 2 ++ .../4_04.calc__stack_cmds/tests/04_error_stack_empty.tin | 1 + .../4_04.calc__stack_cmds/tests/04_error_stack_empty.tout | 4 ++++ .../4_04.calc__stack_cmds/tests/10_add.tin | 1 + .../4_04.calc__stack_cmds/tests/10_add.tout | 1 + .../4_04.calc__stack_cmds/tests/11_sub.tin | 1 + .../4_04.calc__stack_cmds/tests/11_sub.tout | 1 + .../4_04.calc__stack_cmds/tests/12_sub_negative.tin | 1 + .../4_04.calc__stack_cmds/tests/12_sub_negative.tout | 1 + .../4_04.calc__stack_cmds/tests/13_multi.tin | 1 + .../4_04.calc__stack_cmds/tests/13_multi.tout | 1 + .../4_04.calc__stack_cmds/tests/14_div.tin | 1 + .../4_04.calc__stack_cmds/tests/{t02.tout => 14_div.tout} | 0 .../4_04.calc__stack_cmds/tests/15_mod.tin | 1 + .../4_04.calc__stack_cmds/tests/15_mod.tout | 1 + .../4_04.calc__stack_cmds/tests/16_many.tin | 1 + .../4_04.calc__stack_cmds/tests/16_many.tout | 1 + .../4_04.calc__stack_cmds/tests/20_stack_peek.tin | 1 + .../4_04.calc__stack_cmds/tests/20_stack_peek.tout | 2 ++ .../4_04.calc__stack_cmds/tests/21_stack_swap.tin | 1 + .../4_04.calc__stack_cmds/tests/21_stack_swap.tout | 1 + .../4_04.calc__stack_cmds/tests/22_stack_clear.tin | 1 + .../4_04.calc__stack_cmds/tests/22_stack_clear.tout | 2 ++ .../4_04.calc__stack_cmds/tests/t00.tin | 1 - .../4_04.calc__stack_cmds/tests/t00.tout | 1 - .../4_04.calc__stack_cmds/tests/t01.tin | 1 - .../4_04.calc__stack_cmds/tests/t01.tout | 1 - .../4_04.calc__stack_cmds/tests/t02.tin | 1 - .../4_04.calc__stack_cmds/tests/t03.tin | 1 - .../4_04.calc__stack_cmds/tests/t03.tout | 1 - .../4_04.calc__stack_cmds/tests/t04.tin | 1 - .../4_04.calc__stack_cmds/tests/t04.tout | 1 - .../4_04.calc__stack_cmds/tests/t10.tin | 1 - .../4_04.calc__stack_cmds/tests/t10.tout | 2 -- .../4_04.calc__stack_cmds/tests/t11.tin | 1 - .../4_04.calc__stack_cmds/tests/t11.tout | 1 - .../4_04.calc__stack_cmds/tests/t12.tin | 1 - chapter_4.functions_progr_structure/4_05.calc__math/getch.c | 4 ++-- .../4_06.calc__variables/getch.c | 2 +- 84 files changed, 78 insertions(+), 37 deletions(-) rename chapter_4.functions_progr_structure/4_03.calc__modulo_negative/{get_ungetch.c => getch.c} (85%) rename chapter_4.functions_progr_structure/4_03.calc__modulo_negative/{get_ungetch.h => getch.h} (76%) rename chapter_4.functions_progr_structure/4_03.calc__modulo_negative/{pop_push.c => stack.c} (100%) rename chapter_4.functions_progr_structure/4_03.calc__modulo_negative/{pop_push.h => stack.h} (76%) create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/00_error_stack_empty.tin rename chapter_4.functions_progr_structure/{4_04.calc__stack_cmds/tests/t12.tout => 4_03.calc__modulo_negative/tests/00_error_stack_empty.tout} (100%) create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/01_error_unknown_command.tin create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/01_error_unknown_command.tout create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/02_error_zero_divisor.tin create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/02_error_zero_divisor.tout create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/03_error_zero_modulus.tin create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/03_error_zero_modulus.tout create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/10_add.tin create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/10_add.tout create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/11_sub.tin create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/11_sub.tout create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/12_sub_negative.tin create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/12_sub_negative.tout create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/13_multi.tin create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/13_multi.tout create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/14_div.tin rename chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/{t2.tout => 14_div.tout} (100%) create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/15_mod.tin create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/15_mod.tout create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/16_many.tin create mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/16_many.tout delete mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t0.tin delete mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t0.tout delete mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t1.tin delete mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t1.tout delete mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t2.tin delete mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t3.tin delete mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t3.tout delete mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t4.tin delete mode 100644 chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t4.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/00_error_stack_empty.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/00_error_stack_empty.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/01_error_unknown_command.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/01_error_unknown_command.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/02_error_zero_divisor.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/02_error_zero_divisor.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/03_error_zero_modulus.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/03_error_zero_modulus.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/04_error_stack_empty.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/04_error_stack_empty.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/10_add.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/10_add.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/11_sub.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/11_sub.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/12_sub_negative.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/12_sub_negative.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/13_multi.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/13_multi.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/14_div.tin rename chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/{t02.tout => 14_div.tout} (100%) create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/15_mod.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/15_mod.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/16_many.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/16_many.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/20_stack_peek.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/20_stack_peek.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/21_stack_swap.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/21_stack_swap.tout create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/22_stack_clear.tin create mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/22_stack_clear.tout delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t00.tin delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t00.tout delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t01.tin delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t01.tout delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t02.tin delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t03.tin delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t03.tout delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t04.tin delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t04.tout delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t10.tin delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t10.tout delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t11.tin delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t11.tout delete mode 100644 chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t12.tin diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/get_ungetch.c b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getch.c similarity index 85% rename from chapter_4.functions_progr_structure/4_03.calc__modulo_negative/get_ungetch.c rename to chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getch.c index 832c15b..de89648 100644 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/get_ungetch.c +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getch.c @@ -2,12 +2,12 @@ # define BUFSIZE 128 -char buf[BUFSIZE]; /* buffer fir ungetch */ +char buf[BUFSIZE]; /* buffer for ungetch */ int bufp = 0; /* next free position in buf */ /* getch: get a (possibly pushed-back) character */ -int getch(void) +int getch (void) { return (bufp > 0) ? buf[--bufp] : getchar(); } diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/get_ungetch.h b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getch.h similarity index 76% rename from chapter_4.functions_progr_structure/4_03.calc__modulo_negative/get_ungetch.h rename to chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getch.h index e42c830..07e29f0 100644 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/get_ungetch.h +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getch.h @@ -1,8 +1,9 @@ -# ifndef GET_UNGETCH_H -# define GET_UNGETCH_H +# ifndef GETCH_H +# define GETCH_H /* getch: get a (possibly pushed-back) character */ int getch (void); + /* ungetch: push character back on input */ void ungetch (int c); diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getop.c b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getop.c index a0d8526..adf5d70 100644 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getop.c +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/getop.c @@ -2,7 +2,7 @@ # include # include "getop.h" -# include "get_ungetch.h" +# include "getch.h" /* getop: get next character or numeric operand */ diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/main.c b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/main.c index 7618c31..e777d37 100644 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/main.c +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/main.c @@ -1,7 +1,7 @@ # include # include /* for atof */ -# include "pop_push.h" +# include "stack.h" # include "getop.h" # define MAXOP 128 /* max size of operand or operator */ diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/pop_push.c b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/stack.c similarity index 100% rename from chapter_4.functions_progr_structure/4_03.calc__modulo_negative/pop_push.c rename to chapter_4.functions_progr_structure/4_03.calc__modulo_negative/stack.c diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/pop_push.h b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/stack.h similarity index 76% rename from chapter_4.functions_progr_structure/4_03.calc__modulo_negative/pop_push.h rename to chapter_4.functions_progr_structure/4_03.calc__modulo_negative/stack.h index a640747..c9deb46 100644 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/pop_push.h +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/stack.h @@ -1,8 +1,9 @@ -# ifndef POP_PUSH_H -# define POP_PUSH_H +# ifndef STACK_H +# define STACK_H /* push: push f onto stack */ void push (double f); + /* pop: pop and return top value from stack */ double pop (void); diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/00_error_stack_empty.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/00_error_stack_empty.tin new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/00_error_stack_empty.tin @@ -0,0 +1 @@ + diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t12.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/00_error_stack_empty.tout similarity index 100% rename from chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t12.tout rename to chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/00_error_stack_empty.tout diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/01_error_unknown_command.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/01_error_unknown_command.tin new file mode 100644 index 0000000..d583e99 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/01_error_unknown_command.tin @@ -0,0 +1 @@ +1 ( ) diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/01_error_unknown_command.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/01_error_unknown_command.tout new file mode 100644 index 0000000..fa6f648 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/01_error_unknown_command.tout @@ -0,0 +1,3 @@ +error: unknown command ( +error: unknown command ) + 1 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/02_error_zero_divisor.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/02_error_zero_divisor.tin new file mode 100644 index 0000000..8ab6668 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/02_error_zero_divisor.tin @@ -0,0 +1 @@ +5 0 / diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/02_error_zero_divisor.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/02_error_zero_divisor.tout new file mode 100644 index 0000000..b1368e7 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/02_error_zero_divisor.tout @@ -0,0 +1,2 @@ +error: zero divisor + 5 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/03_error_zero_modulus.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/03_error_zero_modulus.tin new file mode 100644 index 0000000..addd103 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/03_error_zero_modulus.tin @@ -0,0 +1 @@ +5 0 % diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/03_error_zero_modulus.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/03_error_zero_modulus.tout new file mode 100644 index 0000000..b47d9ff --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/03_error_zero_modulus.tout @@ -0,0 +1,2 @@ +error: zero modulus + 5 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/10_add.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/10_add.tin new file mode 100644 index 0000000..b7f36f6 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/10_add.tin @@ -0,0 +1 @@ +1024 1024 + diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/10_add.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/10_add.tout new file mode 100644 index 0000000..41d2942 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/10_add.tout @@ -0,0 +1 @@ + 2048 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/11_sub.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/11_sub.tin new file mode 100644 index 0000000..894f21d --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/11_sub.tin @@ -0,0 +1 @@ +1024 2048 - diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/11_sub.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/11_sub.tout new file mode 100644 index 0000000..c865927 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/11_sub.tout @@ -0,0 +1 @@ + -1024 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/12_sub_negative.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/12_sub_negative.tin new file mode 100644 index 0000000..e03d024 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/12_sub_negative.tin @@ -0,0 +1 @@ +-10 -55 - diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/12_sub_negative.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/12_sub_negative.tout new file mode 100644 index 0000000..dcc752e --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/12_sub_negative.tout @@ -0,0 +1 @@ + 45 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/13_multi.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/13_multi.tin new file mode 100644 index 0000000..56b711e --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/13_multi.tin @@ -0,0 +1 @@ +-2 100 -5 * * diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/13_multi.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/13_multi.tout new file mode 100644 index 0000000..e8dc7ff --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/13_multi.tout @@ -0,0 +1 @@ + 1000 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/14_div.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/14_div.tin new file mode 100644 index 0000000..aac6b19 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/14_div.tin @@ -0,0 +1 @@ +125 -5 / 5 / -0.2 / diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t2.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/14_div.tout similarity index 100% rename from chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t2.tout rename to chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/14_div.tout diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/15_mod.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/15_mod.tin new file mode 100644 index 0000000..8ff7c80 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/15_mod.tin @@ -0,0 +1 @@ +20 100 21 % % diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/15_mod.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/15_mod.tout new file mode 100644 index 0000000..95f503e --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/15_mod.tout @@ -0,0 +1 @@ + 4 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/16_many.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/16_many.tin new file mode 100644 index 0000000..10ccf4d --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/16_many.tin @@ -0,0 +1 @@ + -1 1 - 100 * 5 / 25 / 1 + diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/16_many.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/16_many.tout new file mode 100644 index 0000000..295999f --- /dev/null +++ b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/16_many.tout @@ -0,0 +1 @@ + -0.6 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t0.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t0.tin deleted file mode 100644 index 4140005..0000000 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t0.tin +++ /dev/null @@ -1 +0,0 @@ --.1 .1 * diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t0.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t0.tout deleted file mode 100644 index ba12cf8..0000000 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t0.tout +++ /dev/null @@ -1 +0,0 @@ - -0.01 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t1.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t1.tin deleted file mode 100644 index fd159b9..0000000 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t1.tin +++ /dev/null @@ -1 +0,0 @@ -110 -200 + diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t1.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t1.tout deleted file mode 100644 index 20be566..0000000 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t1.tout +++ /dev/null @@ -1 +0,0 @@ - -90 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t2.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t2.tin deleted file mode 100644 index aec7c3e..0000000 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t2.tin +++ /dev/null @@ -1 +0,0 @@ -125 50 % diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t3.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t3.tin deleted file mode 100644 index 2eab7c0..0000000 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t3.tin +++ /dev/null @@ -1 +0,0 @@ -4 2 1 1 + + + diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t3.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t3.tout deleted file mode 100644 index a805baa..0000000 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t3.tout +++ /dev/null @@ -1 +0,0 @@ - 8 diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t4.tin b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t4.tin deleted file mode 100644 index 26a2bf5..0000000 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t4.tin +++ /dev/null @@ -1 +0,0 @@ -4 2 1 1 + + + 3 - diff --git a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t4.tout b/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t4.tout deleted file mode 100644 index faf6f27..0000000 --- a/chapter_4.functions_progr_structure/4_03.calc__modulo_negative/tests/t4.tout +++ /dev/null @@ -1 +0,0 @@ - 5 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/getch.c b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/getch.c index 832c15b..de89648 100644 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/getch.c +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/getch.c @@ -2,12 +2,12 @@ # define BUFSIZE 128 -char buf[BUFSIZE]; /* buffer fir ungetch */ +char buf[BUFSIZE]; /* buffer for ungetch */ int bufp = 0; /* next free position in buf */ /* getch: get a (possibly pushed-back) character */ -int getch(void) +int getch (void) { return (bufp > 0) ? buf[--bufp] : getchar(); } diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/00_error_stack_empty.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/00_error_stack_empty.tin new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/00_error_stack_empty.tin @@ -0,0 +1 @@ + diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/00_error_stack_empty.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/00_error_stack_empty.tout new file mode 100644 index 0000000..700ef7f --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/00_error_stack_empty.tout @@ -0,0 +1,2 @@ +error: stack empty + 0 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/01_error_unknown_command.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/01_error_unknown_command.tin new file mode 100644 index 0000000..d583e99 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/01_error_unknown_command.tin @@ -0,0 +1 @@ +1 ( ) diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/01_error_unknown_command.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/01_error_unknown_command.tout new file mode 100644 index 0000000..fa6f648 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/01_error_unknown_command.tout @@ -0,0 +1,3 @@ +error: unknown command ( +error: unknown command ) + 1 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/02_error_zero_divisor.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/02_error_zero_divisor.tin new file mode 100644 index 0000000..8ab6668 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/02_error_zero_divisor.tin @@ -0,0 +1 @@ +5 0 / diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/02_error_zero_divisor.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/02_error_zero_divisor.tout new file mode 100644 index 0000000..b1368e7 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/02_error_zero_divisor.tout @@ -0,0 +1,2 @@ +error: zero divisor + 5 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/03_error_zero_modulus.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/03_error_zero_modulus.tin new file mode 100644 index 0000000..addd103 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/03_error_zero_modulus.tin @@ -0,0 +1 @@ +5 0 % diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/03_error_zero_modulus.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/03_error_zero_modulus.tout new file mode 100644 index 0000000..b47d9ff --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/03_error_zero_modulus.tout @@ -0,0 +1,2 @@ +error: zero modulus + 5 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/04_error_stack_empty.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/04_error_stack_empty.tin new file mode 100644 index 0000000..d7f31b7 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/04_error_stack_empty.tin @@ -0,0 +1 @@ + : diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/04_error_stack_empty.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/04_error_stack_empty.tout new file mode 100644 index 0000000..3ac450c --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/04_error_stack_empty.tout @@ -0,0 +1,4 @@ +error: stack empty + 0 +error: stack empty + 0 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/10_add.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/10_add.tin new file mode 100644 index 0000000..b7f36f6 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/10_add.tin @@ -0,0 +1 @@ +1024 1024 + diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/10_add.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/10_add.tout new file mode 100644 index 0000000..41d2942 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/10_add.tout @@ -0,0 +1 @@ + 2048 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/11_sub.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/11_sub.tin new file mode 100644 index 0000000..894f21d --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/11_sub.tin @@ -0,0 +1 @@ +1024 2048 - diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/11_sub.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/11_sub.tout new file mode 100644 index 0000000..c865927 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/11_sub.tout @@ -0,0 +1 @@ + -1024 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/12_sub_negative.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/12_sub_negative.tin new file mode 100644 index 0000000..e03d024 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/12_sub_negative.tin @@ -0,0 +1 @@ +-10 -55 - diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/12_sub_negative.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/12_sub_negative.tout new file mode 100644 index 0000000..dcc752e --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/12_sub_negative.tout @@ -0,0 +1 @@ + 45 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/13_multi.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/13_multi.tin new file mode 100644 index 0000000..56b711e --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/13_multi.tin @@ -0,0 +1 @@ +-2 100 -5 * * diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/13_multi.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/13_multi.tout new file mode 100644 index 0000000..e8dc7ff --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/13_multi.tout @@ -0,0 +1 @@ + 1000 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/14_div.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/14_div.tin new file mode 100644 index 0000000..aac6b19 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/14_div.tin @@ -0,0 +1 @@ +125 -5 / 5 / -0.2 / diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t02.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/14_div.tout similarity index 100% rename from chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t02.tout rename to chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/14_div.tout diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/15_mod.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/15_mod.tin new file mode 100644 index 0000000..8ff7c80 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/15_mod.tin @@ -0,0 +1 @@ +20 100 21 % % diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/15_mod.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/15_mod.tout new file mode 100644 index 0000000..95f503e --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/15_mod.tout @@ -0,0 +1 @@ + 4 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/16_many.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/16_many.tin new file mode 100644 index 0000000..10ccf4d --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/16_many.tin @@ -0,0 +1 @@ + -1 1 - 100 * 5 / 25 / 1 + diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/16_many.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/16_many.tout new file mode 100644 index 0000000..295999f --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/16_many.tout @@ -0,0 +1 @@ + -0.6 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/20_stack_peek.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/20_stack_peek.tin new file mode 100644 index 0000000..b30a354 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/20_stack_peek.tin @@ -0,0 +1 @@ +1.01 : 999 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/20_stack_peek.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/20_stack_peek.tout new file mode 100644 index 0000000..8589f7e --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/20_stack_peek.tout @@ -0,0 +1,2 @@ + 1.01 + 999 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/21_stack_swap.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/21_stack_swap.tin new file mode 100644 index 0000000..4a6d376 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/21_stack_swap.tin @@ -0,0 +1 @@ +1 2 3 | diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/21_stack_swap.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/21_stack_swap.tout new file mode 100644 index 0000000..38e4063 --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/21_stack_swap.tout @@ -0,0 +1 @@ + 2 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/22_stack_clear.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/22_stack_clear.tin new file mode 100644 index 0000000..d88fe0d --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/22_stack_clear.tin @@ -0,0 +1 @@ +1 22 300 ! diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/22_stack_clear.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/22_stack_clear.tout new file mode 100644 index 0000000..700ef7f --- /dev/null +++ b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/22_stack_clear.tout @@ -0,0 +1,2 @@ +error: stack empty + 0 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t00.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t00.tin deleted file mode 100644 index 4140005..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t00.tin +++ /dev/null @@ -1 +0,0 @@ --.1 .1 * diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t00.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t00.tout deleted file mode 100644 index ba12cf8..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t00.tout +++ /dev/null @@ -1 +0,0 @@ - -0.01 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t01.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t01.tin deleted file mode 100644 index fd159b9..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t01.tin +++ /dev/null @@ -1 +0,0 @@ -110 -200 + diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t01.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t01.tout deleted file mode 100644 index 20be566..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t01.tout +++ /dev/null @@ -1 +0,0 @@ - -90 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t02.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t02.tin deleted file mode 100644 index aec7c3e..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t02.tin +++ /dev/null @@ -1 +0,0 @@ -125 50 % diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t03.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t03.tin deleted file mode 100644 index 2eab7c0..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t03.tin +++ /dev/null @@ -1 +0,0 @@ -4 2 1 1 + + + diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t03.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t03.tout deleted file mode 100644 index a805baa..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t03.tout +++ /dev/null @@ -1 +0,0 @@ - 8 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t04.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t04.tin deleted file mode 100644 index 26a2bf5..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t04.tin +++ /dev/null @@ -1 +0,0 @@ -4 2 1 1 + + + 3 - diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t04.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t04.tout deleted file mode 100644 index faf6f27..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t04.tout +++ /dev/null @@ -1 +0,0 @@ - 5 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t10.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t10.tin deleted file mode 100644 index c6890a7..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t10.tin +++ /dev/null @@ -1 +0,0 @@ -100 150 200 500 : diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t10.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t10.tout deleted file mode 100644 index fde098c..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t10.tout +++ /dev/null @@ -1,2 +0,0 @@ - 500 - 500 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t11.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t11.tin deleted file mode 100644 index 7a2cd12..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t11.tin +++ /dev/null @@ -1 +0,0 @@ -100 150 200 500 | diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t11.tout b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t11.tout deleted file mode 100644 index 017995a..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t11.tout +++ /dev/null @@ -1 +0,0 @@ - 200 diff --git a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t12.tin b/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t12.tin deleted file mode 100644 index 9abef36..0000000 --- a/chapter_4.functions_progr_structure/4_04.calc__stack_cmds/tests/t12.tin +++ /dev/null @@ -1 +0,0 @@ -100 200 300 500 ! diff --git a/chapter_4.functions_progr_structure/4_05.calc__math/getch.c b/chapter_4.functions_progr_structure/4_05.calc__math/getch.c index 832c15b..de89648 100644 --- a/chapter_4.functions_progr_structure/4_05.calc__math/getch.c +++ b/chapter_4.functions_progr_structure/4_05.calc__math/getch.c @@ -2,12 +2,12 @@ # define BUFSIZE 128 -char buf[BUFSIZE]; /* buffer fir ungetch */ +char buf[BUFSIZE]; /* buffer for ungetch */ int bufp = 0; /* next free position in buf */ /* getch: get a (possibly pushed-back) character */ -int getch(void) +int getch (void) { return (bufp > 0) ? buf[--bufp] : getchar(); } diff --git a/chapter_4.functions_progr_structure/4_06.calc__variables/getch.c b/chapter_4.functions_progr_structure/4_06.calc__variables/getch.c index 7164bb5..de89648 100644 --- a/chapter_4.functions_progr_structure/4_06.calc__variables/getch.c +++ b/chapter_4.functions_progr_structure/4_06.calc__variables/getch.c @@ -2,7 +2,7 @@ # define BUFSIZE 128 -char buf[BUFSIZE]; /* buffer fir ungetch */ +char buf[BUFSIZE]; /* buffer for ungetch */ int bufp = 0; /* next free position in buf */