X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=tests%2Frelationtests.c;h=b9d40dce83015d81a8dd65fbba8cb5029a54030e;hb=34a13e6c40b65d81d877bdbb4ddbff456e2d1543;hp=7b565b626c456ff4877904d8a16d010305ae6251;hpb=e938f8c45fd191d96da48f65262e4efcfada7805;p=rrq%2Frrqmisc.git diff --git a/tests/relationtests.c b/tests/relationtests.c index 7b565b6..b9d40dc 100644 --- a/tests/relationtests.c +++ b/tests/relationtests.c @@ -7,7 +7,7 @@ #define SIZE(x) (sizeof(x)/sizeof(void*)) -static char *tuple2string(Relation *r,tuple *t) { +static char *tuple2string(Relation *r,Tuple *t) { #define LIMIT 10000 static char tmp[10][ LIMIT ]; static int i = 0; @@ -24,15 +24,15 @@ static char *tuple2string(Relation *r,tuple *t) { return tmp[i++]; } -static void query_report(Relation *r,tuple *query) { +static void query_report(Relation *r,Tuple *query) { VectorIndex i; for ( i = 0; i < r->content.table.size; i++ ) { - tuple *t = HashVector_next( &r->content, &i, query ); + Tuple *t = Relation_next( r, &i, query ); fprintf( stderr, "check %s\n", tuple2string( r, t ) ); } } -static void query_report_all(Relation *r,tuple *query[]) { +static void query_report_all(Relation *r,Tuple *query[]) { int j; for ( j = 0; query[j]; j++ ) { fprintf( stderr, "query %s\n", tuple2string( r, query[j] ) ); @@ -46,7 +46,7 @@ static void knockout_report(Relation *r,Vector *v) { VectorIndex i; if ( v ) { for ( i = 0; i < v->size; i++ ) { - tuple **t = (tuple **) Vector_next_used( v, &i ); + Tuple **t = (Tuple **) Vector_next_used( v, &i ); fprintf( stderr, "knock %s\n", tuple2string( r, t? *t : 0 ) ); } Vector_resize( v, 0, Vector_clear_any, 0 ); @@ -55,7 +55,7 @@ static void knockout_report(Relation *r,Vector *v) { } // Test addition with several tuples, terminated by 0 -static void test_Relation_add(Relation *r,tuple *query[]) { +static void test_Relation_add(Relation *r,Tuple *query[]) { int j; for ( j = 0; query[j]; j++ ) { fprintf( stderr, "add %s\n", tuple2string( r, query[j] ) ); @@ -64,7 +64,7 @@ static void test_Relation_add(Relation *r,tuple *query[]) { } // Test deletion with several queries, terminated by 0 -static void test_Relation_delete(Relation *r,tuple *query[]) { +static void test_Relation_delete(Relation *r,Tuple *query[]) { int j; for ( j = 0; query[j]; j++ ) { fprintf( stderr, "delete %s\n", tuple2string( r, query[j] ) ); @@ -75,14 +75,14 @@ static void test_Relation_delete(Relation *r,tuple *query[]) { int main(int argc,char **argv) { // AxB - tuple *data2[] = { + Tuple *data2[] = { TUPLE( "a", "b" ), TUPLE( "a", "c" ), TUPLE( "a", "d" ), TUPLE( "b", "d" ), 0 }; - tuple *query2[] = { + Tuple *query2[] = { TUPLE( "a", 0 ), TUPLE( 0, "d" ), 0 @@ -95,7 +95,7 @@ int main(int argc,char **argv) { test_Relation_delete( &rel2, query2 ); // AxBxC - tuple *data3[] = { + Tuple *data3[] = { TUPLE( "a", "b", "c" ), // *** TUPLE( "a", "c", "d" ), // *** TUPLE( "a", "b", "e" ), // => - @@ -105,7 +105,7 @@ int main(int argc,char **argv) { TUPLE( "f", "b", "d" ), // 0 }; - tuple *query3[] = { + Tuple *query3[] = { TUPLE( "a", 0, "d" ), TUPLE( 0, 0, "d" ), TUPLE( 0, "c", 0 ),