Unit Testing
Posted: Mon Jul 02, 2012 8:53 am
I'm currently setting up some unit tests for our NetBurner code using a Java based connection. I have this piece of code, that I'd like to test a failure on.
iosys.h says that the read() function will return a negative number on failure.
Is there an easy way of creating a failure with read()?
edit: took away statement about maybe causing an error in writeall() after looking at code.
Code: Select all
int read_amount = read(fd_Network, network_buffer, FD_BUFFER_SIZE-1);
writeall(fd_Serial, network_buffer, read_amount);
Is there an easy way of creating a failure with read()?
edit: took away statement about maybe causing an error in writeall() after looking at code.