Subject: Re: [boost] [Polygon] unit tests
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2009-09-02 16:10:38
Simonson, Lucanus J wrote:
> Interval concept high() is called in the internal implementation of many algorithms,
> so even if there is no unit test for it the unit tests do cover it.
> I do understand about template functions not being compiled if not used.
The mentioned line 207 is inside the template "scale_up", and my compilers didn't detect this syntax error. But my point was just that compile tests are important for template libraries, and I see that you basically are aware of this. However, the statement "I do understand about template functions not being compiled if not used." is not the complete truth, because gcc compiles template functions even if not used, but he is not able to detect all typos until the function is used with a concrete type.
> My unit test does return non-zero error code.
You are right, I was misguided by lines like
std::cout << "fail 1\n";
because I hadn't seen that "//this is a compile time test, if it compiles it passes" was written above the function.
> Having multiple files would help in the circumstance where multiple developers
> are breaking and fixing different pieces of the code simultaneously.
I guess for boost it would more be like automatic regression tests run on many different platforms by people you will never meet in person, but you can access the test results by a web interface. However, you will not always have access to the compiler where your code fails, so the fixing might be not as simple as you currently imagine...
So it may be sufficient to just put the compile tests in one file and the functional tests in another. Maybe you would also want to put the long running functional tests in yet another source file, so you don't have to comment them out.
> Thanks, I think reviewing the unit tests is an important and easily
> overlooked area and I'm grateful that you took the time.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk