From 082dee0658b67744ab3428eea964f375f7aab9dc Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Sun, 12 May 2019 15:05:57 +0100 Subject: Added more functionality to Buf, substring, search for characer, and shifting string. --- test_line.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 test_line.c (limited to 'test_line.c') 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 +#include + +#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 -- cgit v1.2.3