The unit in unit test

Hallo everyone,

After reading some code, I started to do some unit test now, so that I can become familiar with the code.

Because I have worked in C for a long time, and I often “think in C”, when I started with the class NodeCache, I tried to test the internal functions. I considered the methods of a class as a “unit”. It led to the details of the implementation of the class and I did not concentrate in the usage of the class.
But in C++ the unit should be a class, and the behavior of the class should be tested. We need to look at the class from outside and try to use it in all possible cases. The internal methods should be kept hidden.

This is my first experience of doing unit test in Calitko. I would like to share it with you. If you have any comments or suggestions, I am very glad to hear that.

I plan to do the unit test for classes in Gnutella first.
Best regards,

Bo

Would you like to post a relpy?


This post starts a thread.
Follow-ups:
Re: The unit in unit test
Hello everyone,  I have just joined the developer group. As suggested by Peter, I will also start with Unit Test to get familiar with the code.  I have set up the environment and (more...)
Re: The unit in unit test
Dear Bob, Yes  mate writing tests is indeed a great way to get familiar with code... Also trying to refactor / comment existing code would also help both ways ( the (more...)
Re: The unit in unit test
Dear Bo, Thank you for this post! I found it quite interesting because it revealed to me a totally different point of view about unit testing! I have never asked myself (more...)