c++ - Unit Test Usage -


as far know, unit tests used test if related function works expected. know, done checking return value of function?

other unit test used in different ways? if please show how.

you can check like. while functional languages return value of function indicator function has done might need inspect global state (with precedural languages) or object state (in object oriented languages) determine test has passed.

as simple (and not necessary) example:

void testsettextsetstext() {   foo foo();   foo.settext("bar");   assertequal("bar", foo.text()); } 

you cannot test void methods in way, actually. technically you're checking return value of method (text()) again here, of time want write tests verifying state visible outside observer enough.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -