test: add assert()s to fix analyzer warnings

Reduce the analyzer spam a bit by adding some extra asserts.
Since it's test code, we can't have enough of them anyways ;-)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-05-07 15:08:48 +02:00
parent be4f551d9f
commit 00080db825
6 changed files with 34 additions and 5 deletions

View File

@@ -52,6 +52,8 @@ strndup_checks(void)
char *firsthalf = strndup(sample, 8);
char *secondhalf = strndup(sample + 8, 8);
assert(firsthalf);
assert(secondhalf);
assert(strcmp(firsthalf, "01234567") == 0);
assert(strcmp(secondhalf, "89abcdef") == 0);
@@ -59,6 +61,7 @@ strndup_checks(void)
free(secondhalf);
allofit = strndup(sample, 20);
assert(allofit);
assert(strcmp(allofit, sample) == 0);
free(allofit);
}