1

I have read a lot about the importance of unit testing, and testing in general. In particular I have read about TDD which, in theory, seems like a good way to ensure effective test coverage for a project.

However, when I look at open source projects, or code that is available as open source, I am having difficulty finding good examples of testing in real projects that I can learn from. In particular I haven't seen much in the way of unit testing (at least not that I can understand).

For example I just downloaded the source code for the Java HotSpot JVM. I thought it would be very useful for me to look at and learn from because a JVM (written in C or C++) will have to deal with many complex issues associated with multithreading and low-level system interaction. Which are the very same things that I'm having difficulty in figuring out how to develop unit tests for. But unfortunately it seems like the amount of code written specifically for testing is quite limited. There is a test directory but it looks like it contains examples of code that can be used to test various different bugs, rather than any formal regression tests or unit tests.

So my question is are there examples of open source projects that use unit testing that I could look at to learn from? Something like a JVM is perfect for me because it is more complex than the project that I am working on, but would face many of the same issues associated with thread interaction and memory management.

2 Answers 2

4

Look at boost.

Boost generally does not accept libraries for submission without complete unit tests. Boost even has a unit test framework of it's own.

1

Take a look at gcc and some of the supporting libraries like GMP, MPFR, and MPC.

All of them have validation suites to verify that they compiled correctly.

Not the answer you're looking for? Browse other questions tagged or ask your own question.