Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src



On 5/28/11 10:46 PM, Christos Zoulas wrote:
In article<20110528161256.AB898175D0%cvs.netbsd.org@localhost>,
Matthias Scheler<source-changes-d%NetBSD.org@localhost>  wrote:
+       assert(pipe(fds) == 0);
[...]
+       assert(write(fds[1], "", 1) == 1);
[...]
+       assert(close(fds[0]) == 0);
+       assert(close(fds[1]) == 0);
[...]
+       assert(sigfillset(&mask) == 0);
[...]
+       assert(sigprocmask(SIG_SETMASK, NULL,&mask) == 0);
[...]
+       assert(close(fd) == 0);

Please don't create assertions that contain code, because compiled with
-DNDEBUG they vanish.

Are these test code?  If so, just replace assert by one of:

- ATF_REQUIRE(boolean_expression)
- ATF_REQUIRE_EQ(expected_value, actual_value)

like:

ATF_REQUIRE(pipe(fds) != 0);
ATF_REQUIRE_EQ(1, write(fds[1], "", 1));

--
Julio Merino / @jmmv


Home | Main Index | Thread Index | Old Index