goldfirere / units

The home of the units Haskell package
94 stars 19 forks source link

Resurrect test suite #10

Closed goldfirere closed 10 years ago

goldfirere commented 10 years ago

We don't have to do this now, but I don't want to forget!

nushio3 commented 10 years ago

As a side effect of separating units-defs, running the tests those refer to specific system of units became tricky. Problem here is that tests can't depend on units-defs because units-defs will depend on the installed version of units, which will always conflict with the inplace version of units (that is, the version under development in front of my eyes.)

<command line>: cannot satisfy -package-id units-2.0-inplace: 
    units-2.0-inplace is shadowed by package units-2.0-584a4368117c4a25e618ef8ccf38eb83
    (use -v for more information)

I've added a trick to build some tests in-routine c.f. 424e3516bf015c8d0a7be8180cb and 1efc0c4eacce380f2dd582fdd8e0586584053914 .

The proper way would be (1) move these tests under units-defs or (2) add subsets of units-defs under Test/ folder for testing. I thought I don't like (1) because I'd also like to apply some tests for units, and I believe (2) is essentially the same as current approach.

Nevertheless this approach is not beautiful and updates can help.

Any suggestions?

goldfirere commented 10 years ago

My thought is to just duplicate some of units-defs in the testsuite -- we wouldn't need much.

In contrast to your comments, though, I do think we need to test runtime behavior, to make sure the unit conversions work out. It would also be nice to test rounding behavior. Finally, though this is quite a bit harder, it would be great to test for programs that don't compile and even their error messages. There is some structure in the singletons library for such testing, and it might be worth copying that over.

All this said, getting a proper testing framework going is quite a bit of work, and I know I don't have time to do this at the moment. Provided we can get some basic tests going for now, I'm happy to leave this until a later date.

nushio3 commented 10 years ago

Hi, I agree that we'd like to test conversion factors via runtime tests, and also to test for compile errors. As you said, let's tackle those problems after a while.