Unit tests to verify time complexity -


Is unit tests used to verify the complexity of time / space for someone?

Thanks

Hugo

This is a pretty good thing That's what you will bring. Make sure you use unit testing for it.

A unit test is primarily a "method" of testing the results of your code. You test whether this happens and it fails when you want to fail it.

The time and place are two variables which are extremely important and you want "faster speed and less space" cost but the program is actually the opposite, you got a bug, this is what is the unit test To find the bug and solve them.

For some time, some unit testing uses some pseudo-code, you may have solved how to solve it, but this is a great way to test:

  Unit_Test_To_See_If_X_Takes_More_Than_Y_Seconds (int max_milli_seconds) {int current_millis = getMillis (); Do_operations_on_objects_and_functions (); Int millis_after_executions = mill milliseconds (); Int elapes_millis = MILLIS_ on-APP - Current_Millis; If (elapsed_millis> max_milli_seconds) emphasize (error); }  

In addition, when you think about it, can you have too many tests? No, it is good to test for all the results you can not do, even if you test for "stupid" things, if you do not investigate any result and a bug has developed, does it mean that It does not exist anymore because you did not see it or did not test it for you? :)


Comments