mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user