test-strerror regression test

From: David Leimbach <leimy2k_at_mac.com>
Date: Sun, 20 Apr 2003 21:10:26 -0500
In /usr/src/tools/regression/lib/libc/string there is a test
"test-strerror.c" which attempts to verify a correct value for
strerror(0);

This is probably a bogus value for strerror even though the posix 
standard
does say it returns a string for any int.  Unless the locales for the 
area are
all predefined somewhere we probably don't need this regression test
as it tests for the validity of the strings.

In fact this test fails due to it not asserting the correct string.

errno = 0;
sret = strerror(0);
assert(strcmp(sret, "Unknown Error: 0") == 0);
assert(errno == EINVAL);


I don't think this code has been tested in a long time...  The string
should be "Undefined error: 0" and why would 0 errno be EINVAL?

If we are going to have a test suite it should at least be correct and
documented don't you think?

Dave
Received on Sun Apr 20 2003 - 17:10:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:04 UTC