Changeset 9c54979


Ignore:
Timestamp:
Jan 15, 2013, 8:25:07 AM (11 years ago)
Author:
Jason Gross <jasongross9@gmail.com>
Parents:
58b6ce5 (diff), 6a20996 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge 6a209963395d62d98c3d6b52daa6fb2e3054ae1b into 58b6ce5427395fc8c1887a2a8c69ea459a1fc9e5
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    r97cdbaf5 r6a20996  
    133133{
    134134  int numfailed=0;
    135   char *s, *path, *home;
     135  char *path, *home;
    136136
    137137  printf("# BEGIN testing owl_util\n");
     
    229229
    230230
    231   s = owl_util_baseclass("barnowl");
    232   FAIL_UNLESS("baseclass barnowl", !strcmp("barnowl", s));
    233   g_free(s);
    234   s = owl_util_baseclass("unbarnowl");
    235   FAIL_UNLESS("baseclass unbarnowl", !strcmp("barnowl", s));
    236   g_free(s);
    237   s = owl_util_baseclass("unununbarnowl.d.d");
    238   FAIL_UNLESS("baseclass unununbarnowl.d.d", !strcmp("barnowl", s));
    239   g_free(s);
    240   s = owl_util_baseclass("ununun.d.d");
    241   FAIL_UNLESS("baseclass ununun.d.d", !strcmp("", s));
    242   g_free(s);
    243   s = owl_util_baseclass("d.d.d.d");
    244   FAIL_UNLESS("baseclass d.d.d.d", !strcmp("d", s));
    245   g_free(s);
    246   s = owl_util_baseclass("n.d.d.d");
    247   FAIL_UNLESS("baseclass n.d.d.d", !strcmp("n", s));
    248   g_free(s);
    249   s = owl_util_baseclass("ununun.");
    250   FAIL_UNLESS("baseclass ununun.", !strcmp(".", s));
    251   g_free(s);
    252   s = owl_util_baseclass("unununu");
    253   FAIL_UNLESS("baseclass unununu", !strcmp("u", s));
    254   g_free(s);
    255 
    256 
    257   s = owl_util_makepath("foo/bar");
    258   FAIL_UNLESS("makepath foo/bar", !strcmp("foo/bar", s));
    259   g_free(s);
    260   s = owl_util_makepath("//foo///bar");
    261   FAIL_UNLESS("makepath //foo///bar", !strcmp("/foo/bar", s));
    262   g_free(s);
    263   s = owl_util_makepath("foo/~//bar/");
    264   FAIL_UNLESS("makepath foo/~//bar/", !strcmp("foo/~/bar/", s));
    265   g_free(s);
    266   s = owl_util_makepath("~thisuserhadreallybetternotexist/foobar/");
    267   FAIL_UNLESS("makepath ~thisuserhadreallybetternotexist/foobar/",
    268               !strcmp("~thisuserhadreallybetternotexist/foobar/", s));
    269   g_free(s);
     231  CHECK_STR_AND_FREE("baseclass barnowl",
     232                     "barnowl", owl_util_baseclass("barnowl"));
     233  CHECK_STR_AND_FREE("baseclass unbarnowl",
     234                     "barnowl", owl_util_baseclass("unbarnowl"));
     235  CHECK_STR_AND_FREE("baseclass unununbarnowl.d.d",
     236                     "barnowl", owl_util_baseclass("unununbarnowl.d.d"));
     237  CHECK_STR_AND_FREE("baseclass ununun.d.d",
     238                     "", owl_util_baseclass("ununun.d.d"));
     239  CHECK_STR_AND_FREE("baseclass d.d.d.d",
     240                     "d", owl_util_baseclass("d.d.d.d"));
     241  CHECK_STR_AND_FREE("baseclass n.d.d.d",
     242                     "n", owl_util_baseclass("n.d.d.d"));
     243  CHECK_STR_AND_FREE("baseclass ununun.",
     244                     ".", owl_util_baseclass("ununun."));
     245  CHECK_STR_AND_FREE("baseclass unununu",
     246                     "u", owl_util_baseclass("unununu"));
     247
     248
     249  CHECK_STR_AND_FREE("makepath foo/bar",
     250                     "foo/bar", owl_util_makepath("foo/bar"));
     251  CHECK_STR_AND_FREE("makepath //foo///bar",
     252                     "/foo/bar", owl_util_makepath("//foo///bar"));
     253  CHECK_STR_AND_FREE("makepath foo/~//bar/",
     254                     "foo/~/bar/", owl_util_makepath("foo/~//bar/"));
     255  CHECK_STR_AND_FREE("makepath ~thisuserhadreallybetternotexist/foobar/",
     256                     "~thisuserhadreallybetternotexist/foobar/",
     257                     owl_util_makepath("~thisuserhadreallybetternotexist/foobar/"));
    270258
    271259  home = g_strdup(owl_global_get_homedir(&g));
    272   s = owl_util_makepath("~");
    273   FAIL_UNLESS("makepath ~", !strcmp(home, s));
    274   g_free(s);
     260  CHECK_STR_AND_FREE("makepath ~",
     261                     home, owl_util_makepath("~"));
    275262
    276263  path = g_build_filename(home, "foo/bar/baz", NULL);
    277   s = owl_util_makepath("~///foo/bar//baz");
    278   FAIL_UNLESS("makepath ~///foo/bar//baz", !strcmp(path, s));
    279   g_free(s);
     264  CHECK_STR_AND_FREE("makepath ~///foo/bar//baz",
     265                     path, owl_util_makepath("~///foo/bar//baz"));
    280266  g_free(path);
    281267  g_free(home);
     
    288274  }
    289275
    290   s = owl_util_makepath("~root");
    291   FAIL_UNLESS("makepath ~root", !strcmp(home, s));
    292   g_free(s);
     276  CHECK_STR_AND_FREE("makepath ~root",
     277                     home, owl_util_makepath("~root"));
    293278
    294279  path = g_build_filename(home, "foo/bar/baz", NULL);
    295   s = owl_util_makepath("~root///foo/bar//baz");
    296   FAIL_UNLESS("makepath ~root///foo/bar//baz", !strcmp(path, s));
    297   g_free(s);
     280  CHECK_STR_AND_FREE("makepath ~root///foo/bar//baz",
     281                     path, owl_util_makepath("~root///foo/bar//baz"));
    298282  g_free(path);
    299283  g_free(home);
Note: See TracChangeset for help on using the changeset viewer.