jeudi 8 mars 2018

good practise to add method to class to check consistency?

I am writing a package which has a lot of complicated indexing for a hierarchical clustering algorithm. I have written unit tests, and in these test I have created a method which checks that some values in the class are consistent with each other. This means I can test if a method breaks it. However, I was wondering if it is good/bad practice to have a method like this defined in the class itself as I haven't seen this before.

Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire