apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: apr/test testtable.c
Date Sat, 27 Jul 2002 23:17:48 GMT
brianp      2002/07/27 16:17:48

  Modified:    test     testtable.c
  Log:
  Added an apr_table_overlap() test
  
  Revision  Changes    Path
  1.3       +30 -1     apr/test/testtable.c
  
  Index: testtable.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testtable.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- testtable.c	5 Jul 2002 09:05:49 -0000	1.2
  +++ testtable.c	27 Jul 2002 23:17:48 -0000	1.3
  @@ -70,7 +70,7 @@
   int main(int argc, const char *const argv[])
   {
       apr_pool_t *p;
  -    apr_table_t *t1;
  +    apr_table_t *t1, *t2;
   
       const char *val;
   
  @@ -80,6 +80,7 @@
       apr_pool_create(&p, NULL);
   
       t1 = apr_table_make(p, 5);
  +    t2 = apr_table_make(p, 5);
   
       fprintf(stderr, "Test 1: apr_table_set...");
       apr_table_set(t1, "foo", "bar");
  @@ -130,6 +131,34 @@
           !(val = apr_table_get(t1, "e")) || strcmp(val, "5") ||
           !(val = apr_table_get(t1, "f")) || strcmp(val, "6") ||
           (apr_table_get(t1, "b") != NULL)) {
  +        fprintf(stderr, "ERROR\n");
  +        exit(-1);
  +    }
  +    fprintf(stderr, "OK\n");
  +
  +    fprintf(stderr, "Test 5: apr_table_overlap...");
  +    apr_table_clear(t1);
  +    apr_table_addn(t1, "a", "0");
  +    apr_table_addn(t1, "g", "7");
  +    apr_table_clear(t2);
  +    apr_table_addn(t2, "a", "1");
  +    apr_table_addn(t2, "b", "2");
  +    apr_table_addn(t2, "c", "3");
  +    apr_table_addn(t2, "b", "2.0");
  +    apr_table_addn(t2, "d", "4");
  +    apr_table_addn(t2, "e", "5");
  +    apr_table_addn(t2, "b", "2.");
  +    apr_table_addn(t2, "f", "6");
  +    apr_table_overlap(t1, t2, APR_OVERLAP_TABLES_SET);
  +    if ((apr_table_elts(t1)->nelts != 7) ||
  +        !(val = apr_table_get(t1, "a")) || strcmp(val, "1") ||
  +        !(val = apr_table_get(t1, "b")) || strcmp(val, "2") ||
  +        !(val = apr_table_get(t1, "c")) || strcmp(val, "3") ||
  +        !(val = apr_table_get(t1, "d")) || strcmp(val, "4") ||
  +        !(val = apr_table_get(t1, "e")) || strcmp(val, "5") ||
  +        !(val = apr_table_get(t1, "f")) || strcmp(val, "6") ||
  +        !(val = apr_table_get(t1, "g")) || strcmp(val, "7") ||
  +        (apr_table_get(t1, "h") != NULL)) {
           fprintf(stderr, "ERROR\n");
           exit(-1);
       }
  
  
  

Mime
View raw message