To run tests from the command line, type cargo test. We will be doing this a lot.
Writing tests
Unit testing
Unit testing focuses on testing internal interfaces and components of a program. It is also called whitebox testing. To first create unit tests, it is a good idea to look at all of the top-level types, traits, and functions. All top-level identifiers make for good test cases. Depending on the structure of the program, it may also be a good idea to test combinations of these components to cover expected use cases.
We have one utility function, the statistic calculation, which would be a good candidate to write a unit test for. However, this function doesn't return any result. Instead, it immediately prints output...