AuroreAA / ICSClust

What the Package Does in One 'Title Case' Line
GNU General Public License v3.0
0 stars 0 forks source link

tests #11

Closed AuroreAA closed 1 year ago

AuroreAA commented 1 year ago

add some unit tests

aalfons commented 1 year ago

@AuroreAA, I had a look, but I think it's easier if you add them since you implemented most of the main functionality.

Some ideas for unit tests:

  1. Test that check whether inputs are handled correctly (e.g., the number of components to retain, the number of clusters to use, ...) and whether the output has the correct format (e.g., that the object returned by ICSClust() has the correct class, that it has a component clusters, that the component clusters is a vector of the same length as the number of observations, etc.). Tests like these make sure that input and output are formally correct.
  2. We can have some tests based on the examples from the paper, where we have thoroughly checked what is happening and that everything is correct. For instance, we know how many components should be selected by different criteria on the iris or crabs data. A very specific one could be that the D'Agostino test for normality results in 0 components being selected for the crabs data. Tests on specific examples like these can indicate when changes in the code introduce problems in the future.
AuroreAA commented 1 year ago

I have added two files: test_ICSClust.R and test-select_crit.R of tests. Feel free to add more if necessary.

We started some tests for the scatters but I don't know if you want to still have one.

For the plots I am not sure how to test them. I made a file with the plots I am running when I want to check if everything is fine but I do not know how (and if we should) convert them to some unit tests.

aalfons commented 1 year ago

Thanks a lot, I'll have a look when I get around to it to see if I can think of any other tests. I'd suggest to keep the file names consistent (test-ICSClust.R instead of test_ICSClust.R).

(Edit: Nevermind, I see now that the file name is test-ICSClust.R and it's just a typo in your comment above.)

For the plots, perhaps we can add some tests based on the "ggplot" object. But I'm not sure how easy it is to test if we have the correct mapping, scales, facets, etc. Those objects are full of functions, quosures, and other programming constructs.

For a first version, it's also not that important to have a complete battery of unit tests (yet). As long as we have some, it's fine by me. It also depends on how much time we have. I wouldn't delay publishing the package for not having enough unit tests.

AuroreAA commented 1 year ago

I have done quite a few. Let me know if that is fine with you.

aalfons commented 1 year ago

I had a look, all fine with me :-)

Thanks!