dh-core icon indicating copy to clipboard operation
dh-core copied to clipboard

datasets: add unit tests

Open ocramz opened this issue 7 years ago • 7 comments

Some unit tests asserting e.g. the length or some other property of the datasets would be nice to have.

ocramz avatar Jan 02 '19 12:01 ocramz

I've been interested in contributing to this project for a while! Is it ok if I take a shot at this issue? I think maybe checking the length, the first and the last element of every dataset could constitute the tests.

Magalame avatar Feb 13 '19 14:02 Magalame

Hi @Magalame , any contribution large or small is very welcome ^^

ocramz avatar Mar 01 '19 07:03 ocramz

Hi again! I was wondering if it wouldn't be more practical to using some form of hashing? Maybe something like hashable?

Magalame avatar Mar 31 '19 20:03 Magalame

@Magalame how would you use hashing for this ?

ocramz avatar Apr 01 '19 04:04 ocramz

I think I misunderstood the purpose of the issue, I thought it was to check the integrity of the data

Magalame avatar Apr 03 '19 01:04 Magalame

Actually I think there is a reasonable way to use hashing for this. We basically want unit tests to make sure that the functions in datasets load the data sets properly.

So a nice way to do that would be, approximately, for each data set:

do
    abas <- getDataset abalone

    head abas `shouldBe` valueOfHeadOfAbas
    last abas `shouldBe` valueOfLastOfAbas
    force (hash abas) `shouldBe` fixedHash

and then the same for getDatavec

It would have the advantage of partly solving #29. And Haskell has a nice Hashable class

Magalame avatar May 07 '19 22:05 Magalame

ping @ocramz

Magalame avatar May 09 '19 17:05 Magalame