Closed rickhg12hs closed 9 years ago
Looks like the tests need to be updated?
I updated the tests, but need to admit that I only updated the values with the ones returned by Travis when the tests were failing. I'm not qualified to assess the correctness of the tests or test results.
I'm a little suspicious that the tests with "hue" all have values between 0 and 1, but according to the type definition it seems it should be between 0 and 360. @jiahao, these are your tests, can you check this out?
Perhaps useful for cross-checking: http://colormine.org/color-converter
Some anecdotal evidence from StackOverflow that this fix may be adequate.
I'm going to merge this, but @jiahao, can you please look at those tests again with respect to the issue I raised above?
I suspect that those tests are correct but we're just testing a very narrow range of hue values.
I'm a little concerned, though, given that prior to this commit we were testing that the algorithm gave incorrect values.
@timholy sorry, just got back from a few weeks' travel.
The tests I added were only confirming behavior that was present 8 months ago, back when I wanted to make sure that the vector space addition operation was correct. I had asked for help in asserting correctness, but nothing transpired then. So I'm happy that people are working through the tests and checking them.
Thanks, @jiahao. I'm no color-space guru myself, so I hope some of the other folks who know this stuff chime in eventually.
Referencing numerous RGB to HSL conversion algorithms (Google search hits, etc.), the min and max values need to be added, not subtracted.