Changeset ce68f23 for tester.c


Ignore:
Timestamp:
Jun 25, 2011, 3:26:16 AM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
c266281
Parents:
3cdd6d2
git-author:
David Benjamin <davidben@mit.edu> (06/11/11 20:06:46)
git-committer:
David Benjamin <davidben@mit.edu> (06/25/11 03:26:16)
Message:
Make owl_dict_get_keys return a GPtrArray

Almost all the remaining uses of owl_list are tightly coupled into this
one giant blob.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    r4e37d56 rce68f23  
    230230int owl_dict_regtest(void) {
    231231  owl_dict d;
    232   owl_list l;
     232  GPtrArray *l;
    233233  int numfailed=0;
    234234  char *av = g_strdup("aval"), *bv = g_strdup("bval"), *cv = g_strdup("cval"),
     
    251251
    252252  FAIL_UNLESS("get_size", 3==owl_dict_get_size(&d));
    253   owl_list_create(&l);
    254   owl_dict_get_keys(&d, &l);
    255   FAIL_UNLESS("get_keys result size", 3==owl_list_get_size(&l));
     253  l = owl_dict_get_keys(&d);
     254  FAIL_UNLESS("get_keys result size", 3 == l->len);
    256255 
    257256  /* these assume the returned keys are sorted */
    258   FAIL_UNLESS("get_keys result val",0==strcmp("a",owl_list_get_element(&l,0)));
    259   FAIL_UNLESS("get_keys result val",0==strcmp("b",owl_list_get_element(&l,1)));
    260   FAIL_UNLESS("get_keys result val",0==strcmp("c",owl_list_get_element(&l,2)));
    261 
    262   owl_list_cleanup(&l, g_free);
     257  FAIL_UNLESS("get_keys result val", 0 == strcmp("a", l->pdata[0]));
     258  FAIL_UNLESS("get_keys result val", 0 == strcmp("b", l->pdata[1]));
     259  FAIL_UNLESS("get_keys result val", 0 == strcmp("c", l->pdata[2]));
     260
     261  owl_ptr_array_free(l, g_free);
    263262  owl_dict_cleanup(&d, NULL);
    264263
Note: See TracChangeset for help on using the changeset viewer.