summaryrefslogtreecommitdiff
path: root/test/test.c
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2010-08-23 17:55:09 +0000
committerMichael Jennings <mej@kainx.org>2010-08-23 17:55:09 +0000
commit8b96666c7c7dd4fc1b52fdb4b55bbc15ca0c071c (patch)
treec99e7812575034fd8d3e4c09dddc077437980b34 /test/test.c
parente14093a9f933fef1826d4036bf9991387020405d (diff)
downloadlibast-8b96666c7c7dd4fc1b52fdb4b55bbc15ca0c071c.tar.gz
Revert coccinelle changes.
Using !! instead of != NULL results in significantly and unacceptably less readable code, and I refuse to accept those changes. Unfortunately, since they were all done at once, I have to revert the whole thing. Oh well. :( SVN revision: 51583
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/test/test.c b/test/test.c
index e73fbb7..1fdff41 100644
--- a/test/test.c
+++ b/test/test.c
@@ -161,8 +161,8 @@ test_strings(void)
s3 = spiftool_substr(NULL, 0, 0);
s4 = spiftool_substr(SPIF_CHARPTR("what the heck"), -5, 42);
TEST_FAIL_IF(strcmp((char *) s1, "ultramicroscopic"));
- TEST_FAIL_IF(!!s2);
- TEST_FAIL_IF(!!s3);
+ TEST_FAIL_IF(s2 != NULL);
+ TEST_FAIL_IF(s3 != NULL);
TEST_FAIL_IF(strcmp((char *) s4, " heck"));
FREE(s1);
FREE(s2);
@@ -327,15 +327,15 @@ test_options(void)
SPIFOPT_FLAGS_SET(SPIFOPT_SETTING_PREPARSE);
spifopt_parse(argc1, argv1);
TEST_FAIL_IF(test_flag_var != 0x10);
- TEST_FAIL_IF(!!file_var);
- TEST_FAIL_IF(!!exec_list);
+ TEST_FAIL_IF(file_var != NULL);
+ TEST_FAIL_IF(exec_list != NULL);
TEST_FAIL_IF(num_var != 0);
TEST_FAIL_IF(geom_var != 0);
spifopt_parse(argc1, argv1);
TEST_FAIL_IF(test_flag_var != 0x13);
- TEST_FAIL_IF(!file_var);
+ TEST_FAIL_IF(file_var == NULL);
TEST_FAIL_IF(strcmp((char *) file_var, "somefile"));
- TEST_FAIL_IF(!exec_list);
+ TEST_FAIL_IF(exec_list == NULL);
TEST_FAIL_IF(num_var != 1);
TEST_FAIL_IF(geom_var != 3);
FREE(file_var);
@@ -348,31 +348,31 @@ test_options(void)
SPIFOPT_FLAGS_SET(SPIFOPT_SETTING_REMOVE_ARGS);
spifopt_parse(argc2, argv2);
TEST_FAIL_IF(strcmp((char *) display, "foo:0"));
- TEST_FAIL_IF(!!name);
+ TEST_FAIL_IF(name != NULL);
TEST_FAIL_IF(strcmp((char *) theme, "mytheme"));
- TEST_FAIL_IF(!exec);
+ TEST_FAIL_IF(exec == NULL);
TEST_FAIL_IF(strcmp((char *) exec[0], "ssh"));
TEST_FAIL_IF(strcmp((char *) exec[1], "foo@bar.com"));
- TEST_FAIL_IF(!!exec[2]);
- TEST_FAIL_IF(!!foo);
+ TEST_FAIL_IF(exec[2] != NULL);
+ TEST_FAIL_IF(foo != NULL);
TEST_FAIL_IF(color != 0);
TEST_FAIL_IF(options != 0x08);
spifopt_parse(argc2, argv2);
TEST_FAIL_IF(strcmp((char *) display, "foo:0"));
TEST_FAIL_IF(strcmp((char *) name, "This is a name"));
TEST_FAIL_IF(strcmp((char *) theme, "mytheme"));
- TEST_FAIL_IF(!exec);
+ TEST_FAIL_IF(exec == NULL);
TEST_FAIL_IF(strcmp((char *) exec[0], "ssh"));
TEST_FAIL_IF(strcmp((char *) exec[1], "foo@bar.com"));
- TEST_FAIL_IF(!!exec[2]);
- TEST_FAIL_IF(!foo);
+ TEST_FAIL_IF(exec[2] != NULL);
+ TEST_FAIL_IF(foo == NULL);
TEST_FAIL_IF(SPIF_PTR_ISNULL(foo[0]));
TEST_FAIL_IF(strcmp((char *) foo[0], "blah"));
TEST_FAIL_IF(SPIF_PTR_ISNULL(foo[1]));
TEST_FAIL_IF(strcmp((char *) foo[1], "-d"));
TEST_FAIL_IF(SPIF_PTR_ISNULL(foo[2]));
TEST_FAIL_IF(strcmp((char *) foo[2], "eatme"));
- TEST_FAIL_IF(!!foo[3]);
+ TEST_FAIL_IF(foo[3] != NULL);
TEST_FAIL_IF(color != 4);
TEST_FAIL_IF(options != 0x1e);
TEST_FAIL_IF(strcmp(argv2[0], "test"));
@@ -463,7 +463,7 @@ test_str(void)
fp = fdopen(fd, "r");
write(mypipe[1], tmp2, sizeof(tmp2));
close(mypipe[1]);
- TEST_FAIL_IF(!fp);
+ TEST_FAIL_IF(fp == NULL);
teststr = spif_str_new_from_fp(fp);
TEST_FAIL_IF(spif_str_ncmp_with_ptr(teststr, SPIF_CHARPTR("string #1"), 9));
TEST_FAIL_IF(spif_str_get_len(teststr) != 9);
@@ -563,11 +563,11 @@ test_str(void)
TEST_BEGIN("spif_str_substr_to_ptr() function");
teststr = spif_str_new_from_ptr(SPIF_CHARPTR(tmp));
foo = spif_str_substr_to_ptr(teststr, 2, 5);
- TEST_FAIL_IF(!foo);
+ TEST_FAIL_IF(foo == NULL);
TEST_FAIL_IF(strcmp((char *) foo, "is is"));
FREE(foo);
foo = spif_str_substr_to_ptr(teststr, -4, 4);
- TEST_FAIL_IF(!foo);
+ TEST_FAIL_IF(foo == NULL);
TEST_FAIL_IF(strcmp((char *) foo, "test"));
FREE(foo);
spif_str_del(teststr);
@@ -842,7 +842,7 @@ test_mbuff(void)
fp = fdopen(fd, "r");
write(mypipe[1], tmp2, sizeof(tmp2));
close(mypipe[1]);
- TEST_FAIL_IF(!fp);
+ TEST_FAIL_IF(fp == NULL);
testmbuff = spif_mbuff_new_from_fp(fp);
TEST_FAIL_IF(spif_mbuff_cmp_with_ptr(testmbuff, tmp2, sizeof(tmp2)));
TEST_FAIL_IF(spif_mbuff_get_len(testmbuff) != sizeof(tmp2));
@@ -918,11 +918,11 @@ test_mbuff(void)
TEST_BEGIN("spif_mbuff_subbuff_to_ptr() function");
testmbuff = spif_mbuff_new_from_ptr(SPIF_CHARPTR(tmp), strlen(tmp));
foo = spif_mbuff_subbuff_to_ptr(testmbuff, 2, 5);
- TEST_FAIL_IF(!foo);
+ TEST_FAIL_IF(foo == NULL);
TEST_FAIL_IF(memcmp((char *) foo, "is is", 5));
FREE(foo);
foo = spif_mbuff_subbuff_to_ptr(testmbuff, -4, 4);
- TEST_FAIL_IF(!foo);
+ TEST_FAIL_IF(foo == NULL);
TEST_FAIL_IF(memcmp((char *) foo, "test", 5));
FREE(foo);
spif_mbuff_del(testmbuff);
@@ -1057,7 +1057,7 @@ test_ustr(void)
fp = fdopen(fd, "r");
write(mypipe[1], tmp2, sizeof(tmp2));
close(mypipe[1]);
- TEST_FAIL_IF(!fp);
+ TEST_FAIL_IF(fp == NULL);
testustr = spif_ustr_new_from_fp(fp);
TEST_FAIL_IF(spif_ustr_ncmp_with_ptr(testustr, SPIF_CHARPTR("string #1"), 9));
TEST_FAIL_IF(spif_ustr_get_len(testustr) != 9);
@@ -1157,11 +1157,11 @@ test_ustr(void)
TEST_BEGIN("spif_ustr_substr_to_ptr() function");
testustr = spif_ustr_new_from_ptr(SPIF_CHARPTR(tmp));
foo = spif_ustr_substr_to_ptr(testustr, 2, 5);
- TEST_FAIL_IF(!foo);
+ TEST_FAIL_IF(foo == NULL);
TEST_FAIL_IF(strcmp((char *) foo, "is is"));
FREE(foo);
foo = spif_ustr_substr_to_ptr(testustr, -4, 4);
- TEST_FAIL_IF(!foo);
+ TEST_FAIL_IF(foo == NULL);
TEST_FAIL_IF(strcmp((char *) foo, "test"));
FREE(foo);
spif_ustr_del(testustr);