Writing Tests for colStats
You’re going to make a lot of changes to this code base to improve its performance. Before doing that, let’s write tests to make sure the program works correctly. Then you can use those tests to ensure the program still works as you change the underlying code.
For these tests, you’ll follow the same approach used to define tests in Writing Tests for the Markdown Preview Tool. You’ll create unit tests for the avg and sum statistics functions as well as for the csv2float function. For the integration tests, you’ll test the function run. You’ll also apply table-driven testing as you did for Testing with Table-Driven Testing.
Let’s start by writing unit tests for the statistics operations. In the same directory as ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access