I've never written a unit test or any test for my c++ Programs. I know just that they are meant to testing if the function/program/unit does exactly what you think it does, But I have no idea how to write one.
Can anybody help me with a test for my example function? And what is meant with a test framework? Do I write tests for every function of my code and all the branches, or just the ones I think can be tricky?
doMode(int i) {
int a = fromString<int>(Action[i][1]);
int b = fromString<int>(Action[i][2]);
std::cout << "Parameter:\t" << a << "\t" << b << "\t" << std::endl;
Sleep(200);
return;
}
Edit: I'm not asking for a framework. or better: probably that is connected with my question. I just don't know where and how to start. What is the syntax I have to use? is it different depending on which framework I use?