summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ftell-test.c17
-rw-r--r--test/neg-test.c12
-rw-r--r--test/randstring-test.c12
-rw-r--r--test/tape-test.bvr1
-rw-r--r--test/tape-test.c10
5 files changed, 52 insertions, 0 deletions
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 <stdlib.h>
+#include <stdio.h>
+
+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 <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+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 <stdlib.h>
+#include <stdio.h>
+#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 @@
+<h1><@this should be replaced with constant aaaaa@></h1>
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 <stdlib.h>
+#include <stdio.h>
+#include <tape.c>
+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]);
+}