commit 05746a1dde99df53d5122c11b9244a4ee4246ba0
parent d5b15d279a1225471a8886a0eb9c4fe88d32210b
Author: glenda <glenda@9front.local>
Date: Mon, 21 Sep 2020 13:17:08 +0000
oops forgot test_cells.c file
Diffstat:
M | test_cells.c | | | 52 | ++++++++++++++++++++++++++++++++++++++++------------ |
1 file changed, 40 insertions(+), 12 deletions(-)
diff --git a/test_cells.c b/test_cells.c
@@ -5,20 +5,48 @@
#define ECHO(X) print("=> %s\n", "X"); X
+void test_table_read(void);
+
void
main(void)
{
- Table T, TT, N;
+
+
+ test_table_read();
+ return;
+
+
+ Table T, TT, N, B;
Value v, r;
- char *str = "hello";
- ECHO(T = empty_table());
- ECHO(v = mk_value(xy2addr(0, 0), str));
- ECHO(TT = copy_table(T));
- ECHO(N = table_put(T, v));
- ECHO(r = table_get(N, xy2addr(0, 0)));
- print("data = %s\n", r.data);
- ECHO(free_table(TT));
- ECHO(free_table(T));
- ECHO(free_value(v));
- ECHO(free_table(N));
+ char *str1 = "hello";
+ char *str2 = "world";
+ char *str3 = "wide";
+
+ T = empty_table();
+ B = T;
+ N = table_put(T, mk_value(xy2addr(1, 1), str1));
+ B = N;
+ N = table_put(B, mk_value(xy2addr(1, 2), str2));
+ free_table(B);
+ B = N;
+ N = table_put(B, mk_value(xy2addr(1, 3), str3));
+ free_table(B);
+ B = N;
+
+ print_table(N);
+
+ free_table(T);
+ free_table(N);
+
+
+}
+
+void
+test_table_read(void)
+{
+ Table T;
+ int i;
+ char *fname = "example.tsv";
+ T = table_read(fname);
+ print_table(T);
}