test_cells.c (688B)
1 #include <u.h> 2 #include <libc.h> 3 4 #include "cells.h" 5 6 #define ECHO(X) print("=> %s\n", "X"); X 7 8 void test_table_read(void); 9 10 void 11 main(void) 12 { 13 14 15 test_table_read(); 16 return; 17 18 19 Table T, TT, N, B; 20 Value v, r; 21 char *str1 = "hello"; 22 char *str2 = "world"; 23 char *str3 = "wide"; 24 25 T = empty_table(); 26 B = T; 27 N = table_put(T, mk_value(xy2addr(1, 1), str1)); 28 B = N; 29 N = table_put(B, mk_value(xy2addr(1, 2), str2)); 30 free_table(B); 31 B = N; 32 N = table_put(B, mk_value(xy2addr(1, 3), str3)); 33 free_table(B); 34 B = N; 35 36 print_table(N); 37 38 free_table(T); 39 free_table(N); 40 41 42 } 43 44 void 45 test_table_read(void) 46 { 47 Table T; 48 int i; 49 char *fname = "example.tsv"; 50 T = table_read(fname); 51 print_table(T); 52 }