How to write parameterized tests in Elm

There’s a common testing principle that many people follow, which is that a test should only have a single reason to fail. That way, you don’t end up with tests failing and keeping you from getting information about other assertions in the test case. And you have a clear focus for each test. elm-test takes that stance. That’s why Expect.all applies to a single test subject. And perhaps it helps explain the design if I point out that the subject argument is really intended to be a single test subject that you make multiple assertions about, so passing in True or False as the last argument to Expect.all is probably going to end up feeling awkward I would say.

Also, I would recommend trying out Expect.true and Expect.false instead of Expect.equal. You can create a nice helper function for isOdd or whatever helpers would make sense.

isOdd n =
  (n |> modBy 2 == 0)
  |> Expect.false "Expected an odd number."

Hope that helps!