Commit ed809fc1 authored by Daniel Salzman's avatar Daniel Salzman

unittests: fix warnings - empty string

parent f65217e1
......@@ -41,14 +41,14 @@ int main(int argc, char *argv[])
ret = base32hex_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "1. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "1. test vector - ENC output content");
}
ret = base32hex_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "1. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "1. test vector - DEC output content");
}
......@@ -61,14 +61,14 @@ int main(int argc, char *argv[])
ret = base32hex_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "2. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "2. test vector - ENC output content");
}
ret = base32hex_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "2. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "2. test vector - DEC output content");
}
......@@ -81,14 +81,14 @@ int main(int argc, char *argv[])
ret = base32hex_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "3. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "3. test vector - ENC output content");
}
ret = base32hex_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "3. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "3. test vector - DEC output content");
}
......@@ -101,14 +101,14 @@ int main(int argc, char *argv[])
ret = base32hex_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "4. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "4. test vector - ENC output content");
}
ret = base32hex_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "4. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "4. test vector - DEC output content");
}
......@@ -121,14 +121,14 @@ int main(int argc, char *argv[])
ret = base32hex_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "5. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "5. test vector - ENC output content");
}
ret = base32hex_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "5. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "5. test vector - DEC output content");
}
......@@ -141,14 +141,14 @@ int main(int argc, char *argv[])
ret = base32hex_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "6. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "6. test vector - ENC output content");
}
ret = base32hex_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "6. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "6. test vector - DEC output content");
}
......@@ -161,51 +161,51 @@ int main(int argc, char *argv[])
ret = base32hex_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "7. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "7. test vector - ENC output content");
}
ret = base32hex_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "7. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "7. test vector - DEC output content");
}
// Bad paddings
ret = base32hex_decode((uint8_t *)"AAAAAA==", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad padding length 2");
ret = base32hex_decode((uint8_t *)"AAA=====", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad padding length 5");
ret = base32hex_decode((uint8_t *)"A======", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad padding length 7");
ret = base32hex_decode((uint8_t *)"=======", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad padding length 8");
ret = base32hex_decode((uint8_t *)"AAAAAA==", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad padding length 2");
ret = base32hex_decode((uint8_t *)"AAA=====", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad padding length 5");
ret = base32hex_decode((uint8_t *)"A======", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad padding length 7");
ret = base32hex_decode((uint8_t *)"=======", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad padding length 8");
// Bad data length
ret = base32hex_decode((uint8_t *)"A", 1, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 1");
ret = base32hex_decode((uint8_t *)"AA", 2, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 2");
ret = base32hex_decode((uint8_t *)"AAA", 3, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 3");
ret = base32hex_decode((uint8_t *)"AAAA", 4, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 4");
ret = base32hex_decode((uint8_t *)"AAAAA", 5, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 5");
ret = base32hex_decode((uint8_t *)"AAAAAA", 6, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 6");
ret = base32hex_decode((uint8_t *)"AAAAAAA", 7, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 7");
ret = base32hex_decode((uint8_t *)"AAAAAAAAA", 9, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 9");
ret = base32hex_decode((uint8_t *)"A", 1, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 1");
ret = base32hex_decode((uint8_t *)"AA", 2, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 2");
ret = base32hex_decode((uint8_t *)"AAA", 3, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 3");
ret = base32hex_decode((uint8_t *)"AAAA", 4, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 4");
ret = base32hex_decode((uint8_t *)"AAAAA", 5, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 5");
ret = base32hex_decode((uint8_t *)"AAAAAA", 6, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 6");
ret = base32hex_decode((uint8_t *)"AAAAAAA", 7, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 7");
ret = base32hex_decode((uint8_t *)"AAAAAAAAA", 9, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ESIZE, "Bad data length 9");
// Bad data character
ret = base32hex_decode((uint8_t *)"AAAAAAA$", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad data character dollar");
ret = base32hex_decode((uint8_t *)"AAAAAAA ", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad data character space");
ret = base32hex_decode((uint8_t *)"AAAAAAA$", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad data character dollar");
ret = base32hex_decode((uint8_t *)"AAAAAAA ", 8, out, BUF_LEN);
ok(ret == KNOT_BASE32HEX_ECHAR, "Bad data character space");
return 0;
}
......@@ -41,14 +41,14 @@ int main(int argc, char *argv[])
ret = base64_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "1. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "1. test vector - ENC output content");
}
ret = base64_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "1. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "1. test vector - DEC output content");
}
......@@ -61,14 +61,14 @@ int main(int argc, char *argv[])
ret = base64_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "2. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "2. test vector - ENC output content");
}
ret = base64_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "2. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "2. test vector - DEC output content");
}
......@@ -81,14 +81,14 @@ int main(int argc, char *argv[])
ret = base64_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "3. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "3. test vector - ENC output content");
}
ret = base64_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "3. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "3. test vector - DEC output content");
}
......@@ -101,14 +101,14 @@ int main(int argc, char *argv[])
ret = base64_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "4. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "4. test vector - ENC output content");
}
ret = base64_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "4. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "4. test vector - DEC output content");
}
......@@ -121,14 +121,14 @@ int main(int argc, char *argv[])
ret = base64_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "5. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "5. test vector - ENC output content");
}
ret = base64_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "5. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "5. test vector - DEC output content");
}
......@@ -141,14 +141,14 @@ int main(int argc, char *argv[])
ret = base64_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "6. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "6. test vector - ENC output content");
}
ret = base64_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "6. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "6. test vector - DEC output content");
}
......@@ -161,39 +161,39 @@ int main(int argc, char *argv[])
ret = base64_encode(in, in_len, out, BUF_LEN);
ok(ret == ref_len, "7. test vector - ENC output length");
if (ret < 0) {
skip(NULL);
skip("Encode err");
} else {
ok(memcmp(out, ref, ret) == 0, "7. test vector - ENC output content");
}
ret = base64_decode(out, ret, out2, BUF_LEN);
ok(ret == in_len, "7. test vector - DEC output length");
if (ret < 0) {
skip(NULL);
skip("Decode err");
} else {
ok(memcmp(out2, in, ret) == 0, "7. test vector - DEC output content");
}
// Bad paddings
ret = base64_decode((uint8_t *)"A===", 4, out, BUF_LEN);
ok(ret == KNOT_BASE64_ECHAR, "Bad padding length 3");
ret = base64_decode((uint8_t *)"====", 4, out, BUF_LEN);
ok(ret == KNOT_BASE64_ECHAR, "Bad padding length 4");
ret = base64_decode((uint8_t *)"A===", 4, out, BUF_LEN);
ok(ret == KNOT_BASE64_ECHAR, "Bad padding length 3");
ret = base64_decode((uint8_t *)"====", 4, out, BUF_LEN);
ok(ret == KNOT_BASE64_ECHAR, "Bad padding length 4");
// Bad data length
ret = base64_decode((uint8_t *)"A", 1, out, BUF_LEN);
ok(ret == KNOT_BASE64_ESIZE, "Bad data length 1");
ret = base64_decode((uint8_t *)"AA", 2, out, BUF_LEN);
ok(ret == KNOT_BASE64_ESIZE, "Bad data length 2");
ret = base64_decode((uint8_t *)"AAA", 3, out, BUF_LEN);
ok(ret == KNOT_BASE64_ESIZE, "Bad data length 3");
ret = base64_decode((uint8_t *)"AAAAA", 5, out, BUF_LEN);
ok(ret == KNOT_BASE64_ESIZE, "Bad data length 5");
ret = base64_decode((uint8_t *)"A", 1, out, BUF_LEN);
ok(ret == KNOT_BASE64_ESIZE, "Bad data length 1");
ret = base64_decode((uint8_t *)"AA", 2, out, BUF_LEN);
ok(ret == KNOT_BASE64_ESIZE, "Bad data length 2");
ret = base64_decode((uint8_t *)"AAA", 3, out, BUF_LEN);
ok(ret == KNOT_BASE64_ESIZE, "Bad data length 3");
ret = base64_decode((uint8_t *)"AAAAA", 5, out, BUF_LEN);
ok(ret == KNOT_BASE64_ESIZE, "Bad data length 5");
// Bad data character
ret = base64_decode((uint8_t *)"AAA$", 4, out, BUF_LEN);
ok(ret == KNOT_BASE64_ECHAR, "Bad data character dollar");
ret = base64_decode((uint8_t *)"AAA ", 4, out, BUF_LEN);
ok(ret == KNOT_BASE64_ECHAR, "Bad data character space");
ret = base64_decode((uint8_t *)"AAA$", 4, out, BUF_LEN);
ok(ret == KNOT_BASE64_ECHAR, "Bad data character dollar");
ret = base64_decode((uint8_t *)"AAA ", 4, out, BUF_LEN);
ok(ret == KNOT_BASE64_ECHAR, "Bad data character space");
return 0;
}
......@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
int ret = conf_parse_str(conf, sample_conf_rc);
is_int(0, ret, "parsing configuration file %s", config_fn);
if (ret != 0) {
skip_block(19, NULL);
skip_block(19, "Parse err");
goto skip_all;
}
......@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
ok(log->type == LOGT_SYSLOG, "log0 is syslog");
if (EMPTY_LIST(log->map)) {
skip_block(5, NULL);
skip_block(5, "Empty list");
} else {
ok(m->source == LOG_ANY, "syslog first rule is ANY");
int mask = LOG_MASK(LOG_NOTICE)|LOG_MASK(LOG_WARNING)|LOG_MASK(LOG_ERR);
......@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
m = (conf_log_map_t*)nm;
ok(m != 0, "syslog has more than 1 rule");
if (m == 0) {
skip_block(2, NULL);
skip_block(2, "No mapping");
} else {
ok(m->source == LOG_ZONE, "syslog next rule is for zone");
ok(m->prios == 0xff, "rule for zone is: any level");
......@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
log = (conf_log_t*)n;
ok(n != 0, "log has next facility");
if (n == 0) {
skip(NULL);
skip("No mapping");
} else {
is_string("/var/log/knot/server.err", log->file, "log file matches");
}
......
......@@ -187,7 +187,7 @@ int main(int argc, char *argv[])
dt_unit_t *unit = dt_test_create(2);
ok(unit != 0, "dthreads: create unit (optimal size %d)", unit->size);
if (unit == 0) {
skip_block(17, NULL);
skip_block(17, "No dthreads unit");
goto skip_all;
}
......
......@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
int tmp_fd = mkstemp(jfn_buf);
ok(tmp_fd >= 0, "journal: create temporary file");
if (tmp_fd < 0) {
skip_block(JOURNAL_TEST_COUNT - 1, NULL);
skip_block(JOURNAL_TEST_COUNT - 1, "No temporary file");
goto skip_all;
}
close(tmp_fd);
......@@ -187,7 +187,7 @@ int main(int argc, char *argv[])
ret = journal_map(j, 0x12345, &mptr, sizeof(chk_buf));
ok(mptr && ret == 0, "journal: mapped journal entry");
if (ret != 0) {
skip_block(2, NULL);
skip_block(2, "No mapped journal");
} else {
/* Write to mmaped entry and unmap. */
memcpy(mptr, chk_buf, sizeof(chk_buf));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment