From 6961e4237f24306ab2475f4f527a7c802134c4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20L=2E=20=C5=A0ijanec?= Date: Fri, 1 May 2020 15:18:12 +0200 Subject: added working inline command tag detector, more constants ability to change inline command tag characters, variable length and count and buffer size from define headers. TODO: line-commands (lines, starting with ?) comments (lines, starting with #) --- test/ftell-test.c | 17 +++++++++++++++++ test/neg-test.c | 12 ++++++++++++ test/randstring-test.c | 12 ++++++++++++ test/tape-test.bvr | 1 + test/tape-test.c | 10 ++++++++++ 5 files changed, 52 insertions(+) create mode 100644 test/ftell-test.c create mode 100644 test/neg-test.c create mode 100644 test/randstring-test.c create mode 100644 test/tape-test.bvr create mode 100644 test/tape-test.c (limited to 'test') diff --git a/test/ftell-test.c b/test/ftell-test.c new file mode 100644 index 0000000..e0dd374 --- /dev/null +++ b/test/ftell-test.c @@ -0,0 +1,17 @@ +#include +#include + +extern int main(int argc, char* argv[]) { + if(argc != 2) { + printf("usage: %s filename-to-read\n", argv[0]); + return 1; + } + FILE * temp_input_file = fopen(argv[1], "r"); + char char_buffer = fgetc(temp_input_file); + while(char_buffer != EOF) { + printf("I have character %c on position %ld\n", char_buffer, ftell(temp_input_file)-1); + char_buffer = fgetc(temp_input_file); + } + printf("reached EOF!\n"); + return 0; +} diff --git a/test/neg-test.c b/test/neg-test.c new file mode 100644 index 0000000..3629737 --- /dev/null +++ b/test/neg-test.c @@ -0,0 +1,12 @@ +#include +#include +#include +extern int main(int argc, char* argv[]) { + char array[] = {'s','i','j','a','n','e','c',' '}; + printf("it should always be sijanec and a space character for 2000 characters or OB1\n"); + for(int i=0;i<=2000;i++) { + printf("%c", array[i% sizeof(array)]); + fflush(stdout); + } + return 0; +} diff --git a/test/randstring-test.c b/test/randstring-test.c new file mode 100644 index 0000000..644a0d9 --- /dev/null +++ b/test/randstring-test.c @@ -0,0 +1,12 @@ +#include +#include +#include "randstring.c" + +extern int main(int argc, char* argv[]) { + if(argc != 2) { + printf("usage: %s length\n", argv[0]); + return 1; + } + printf("generated string:\n%s\n", randstring(atoi(argv[1]))); + return 0; +} diff --git a/test/tape-test.bvr b/test/tape-test.bvr new file mode 100644 index 0000000..8d934c5 --- /dev/null +++ b/test/tape-test.bvr @@ -0,0 +1 @@ +

<@this should be replaced with constant aaaaa@>

diff --git a/test/tape-test.c b/test/tape-test.c new file mode 100644 index 0000000..f1cca25 --- /dev/null +++ b/test/tape-test.c @@ -0,0 +1,10 @@ +#include +#include +#include +extern int main(int argc, char* argv[]) { + if(argc != 3) { + printf("usage: %s source-file file-with-commands-replaced-with-a's\n", argv[0]); + return 1; + } + return bvr_compose_page(argv[1], 0, argv[2]); +} -- cgit v1.2.3