portability fixes
[rrq/rrqmisc.git] / tests / relationtests.c
index 7b565b626c456ff4877904d8a16d010305ae6251..b9d40dce83015d81a8dd65fbba8cb5029a54030e 100644 (file)
@@ -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" ), // <a,b,?> <a,?,c> ***
        TUPLE( "a", "c", "d" ), // <a,c,?> <a,?,d> ***
        TUPLE( "a", "b", "e" ), // <a,b,?> <a,?,e> => -<a,b,c>
@@ -105,7 +105,7 @@ int main(int argc,char **argv) {
        TUPLE( "f", "b", "d" ), // <f,b,?> <f,?,c>
        0
     };
-    tuple *query3[] = {
+    Tuple *query3[] = {
        TUPLE( "a", 0, "d" ),
        TUPLE( 0, 0, "d" ),
        TUPLE( 0, "c", 0 ),