jeudi 3 mars 2016

How to test access to a private function?

No I do not want to know how I can test a private function. I want to know how I can test the access to a private function. Example:

class Random{
    public:
        ...
    private:
        Serial();
        OR
        random_function();

In this case it is impossible to instantiate an object of the class random because Serial is private.

If there is just the function random_function() and wee have an object of Serial we can not access the function like object.random_function().

So know you would say: "Thats stupid, you should know what you doing"

But if you consider a case in which a group is working on a project and there are methods who should obvious be private...

How is it possible to regard that when writing test cases (in C++) ?

Aucun commentaire:

Enregistrer un commentaire