Re: [dev] Suckless unit testing in C?

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Wed, 25 Feb 2015 08:14:52 +0100

On 25 February 2015 at 08:04, Eduardo A. Bustamante López
<dualbus_AT_gmail.com> wrote:
> On Wed, Feb 25, 2015 at 07:45:58AM +0100, Anselm R Garbe wrote:
> [...]
>> If you apply the Unix principle correctly, main() is your unit test.
>>
>> All you need is creating test input, save the test output and whenever
>> you call main() with the same test input, you just check for
>> regressions in the test output compared to the expected test output.
>
> What if you're trying to test a program that requires network connectivity?
> It'd be good to be able to mock the networking stuff.

If you develop a client against some mock server, you should check if
it wouldn't be a better idea to use the real server or to implement a
real server instead of a mock server to begin with ;) You not only
save a lot of wasted time developing mock stuff, you also benefit from
implementing an interface on both sides, which is always beneficial.

-Anselm
Received on Wed Feb 25 2015 - 08:14:52 CET

This archive was generated by hypermail 2.3.0 : Wed Feb 25 2015 - 08:24:06 CET