Closed AuroreAA closed 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:
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.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.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.
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.
I have done quite a few. Let me know if that is fine with you.
I had a look, all fine with me :-)
Thanks!
add some unit tests