How can create a test unit for the case function?

I am trying to create a test unit for the switch function where my switch is calling functions from different packages depending on the Byte. Can someone please help me with that?

I would take it on faith that the switch statement works as advertised. Perhaps there is some real result or effect of calling your function that you can test for?

1 Like

It all depends what you want to test. If you want to ensure that all possible values are covered, you have to create a test that provides all values to the switch case.

You can eventually, reduce the set of values to the critical ones.

The purpose of units tests is to be able to ensure that your code remains valid after modifications.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.