Unit tests first and foremost are a way to ensure permanence. They are there to ensure that when you provide an input, you get the expected output. Normally it also checks correctness, but sometimes the tests don't test the correct thing. Whatever they test for becomes permanent.
Therefore, testing mathematical calculations is probably not a thing that should be tested for every possible outcome.
Correct. You want to test enough to ensure the function is doing the right thing, but you don't need to test every value. Often that means testing both sides of boundary conditions, and perhaps an easy to verify value in the middle.
Generally in test writing you have a test that hits the happy path -- doing everything right -- then a bunch of tests that excercse all the error conditions.
Also another key about unit tests is that they need to be fast. If they hit a database, hit a file system, hit a network, they are not a unit test they are an integration test.
I think, it would help a lot if you could show me a simple example on how to invoke unit testing into a tiny code example using a class and whatnot.
It is Java rather than C++, but I've seen this tutorial used several times for starting to build Tetris using test driven development.
You will need to adjust it to your preferred testing framework, but that is generally easy to do.
There's also this amazing book that is freely available as a web site, less of a tutorial and more of a reference, it works through common patterns and struggles in automated tests.