-
Notifications
You must be signed in to change notification settings - Fork 35
No easy way to compare lists (or other datasets) in a manner other than exact equals #208
Comments
@JonathanFraser can you show us some code (or pseudocode) of what you'd like to be able to do? |
Specifically I was implementing some numeric code (DFT), this type of transform operates in a matrix multiplication type fashion. Moreover, it uses complex numbers so I need a custom data type to capture the pair. The type signature of the function in question is: I would like to be able to compare the two lists with a custom operator, something like:
or something similar that allows for the same properties testing but with a datastructure that won't obey exact equality. |
It sounds to me like you want a functions of the sort existing in this module: https://github.com/NoRedInk/elm-formatted-text/blob/master/tests/EqualCheck.elm Granted, the functions there's not a I've also been in the position where I felt I needed to build a custom equality function to go along with a custom type I created, for writing tests around that type. I'm not a hundred percent sure yet the approach taken in the module linked above is the best, but it might be nice to experiment with it, perhaps build a library for specifically that purpose. |
I have this problem too. I have two lists and want to check that one is a subset of the other (with some slight domain-specific complexity as well). I have a predicate I can use to test the subset part, but I lack the ability to make an Expectation with the two inputs. Right now I'm doing:
|
As the title says, take for example the case where I would like to compare a
List Float
or similar case. There is no method toreduce: List Expectation -> Expectation
orcustomListEquals: (a -> a -> Expectation) -> List a -> List a -> Expectation
The text was updated successfully, but these errors were encountered: