diff options
Diffstat (limited to 'test_line.c')
-rw-r--r-- | test_line.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/test_line.c b/test_line.c new file mode 100644 index 0000000..3c3ccab --- /dev/null +++ b/test_line.c @@ -0,0 +1,65 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "__cpp.h" +#include "buf.h" +#include "buf_misc.h" +#include "debug.h" + +void blow_if_error(int err) +{ + if (err < 0) + { + printf("Should be no error but there is\n"); + exit(1); + } +} + +//#define B(X) PNL();blow_if_error(X); +#define B(X) blow_if_error(X); + +void error_is_good(int err) +{ + if (err >= 0) + { + printf("Should be error but there is no\n"); + exit(1); + } +} +#define E(X) error_is_good(X); + +int main() +{ + Buf *b1=NULL, *b2=NULL, *b3=NULL; + BufLine *bline=NULL; + + printf("Start test\n"); + b1 = new Buf(8); + b2 = new Buf(8); + b3 = new Buf(1); + bline = new BufLine(32); + + char n1[] = "Line"; + char n2[] = "Home"; + char n3[] = "\n"; + + b1->set(n1); + b2->set(n2); + b3->set(n3); + b1->print(); printf("\n"); + b2->print(); printf("\n"); + b1->print(); printf("\n"); + bline->print(); printf("\n"); + + printf("Add data\n"); + + bline->add(b1); bline->print(); printf("\n"); + bline->add(b3); + bline->add(b2); bline->print(); printf("\n"); + + printf("Get line\n"); + + printf("End test\n"); + + return 0; +}
\ No newline at end of file |