-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor and improve tests for the builder library #2580
Comments
I'd like to see others weigh in on this too, but the tests you have proposed are not equivalent.
(
builder.name("x", tt),
builder.name("set", SetT1(tt)),
builder.name("p", InvalidTypeMethods.notBool),
)
(
builder.name("x", InvalidTypeMethods.differentFrom(tt)),
builder.name("set", SetT1(tt)),
builder.name("p", BoolT1),
),
(
builder.name("x", tt),
builder.name("set", SetT1(InvalidTypeMethods.differentFrom(tt))),
builder.name("p", BoolT1),
),
(
builder.name("x", tt),
builder.name("set", InvalidTypeMethods.notSet),
builder.name("p", BoolT1),
), The more verbose collection above is a decomposition of the equivalence classes of builder failure. They are all instances of
Ultimately, by my assessment:
Yes, because it skips structure checking, and because it collapses all failure scenarios into one, which I'm not sure you can even do for all operators.
Untrue, since the
Subjective, but I'm not opposed to more verbose test names, or splintering away |
The current tests use a lot of machinery around ScalaCheck that doesn't add any value afaict. On the contrary, it seem to make it considerably more difficult to read and understand the tests than it would be if we were using the usual PBT idioms advised by scalacheck. It is also difficult to know what has gone wrong when the tests fail, since the tests are doing too many things in each case and have undescriptive names.
Here is an example of a test case in the current approach:
apalache/tlair/src/test/scala/at/forsyte/apalache/tla/typecomp/TestBaseBuilder.scala
Lines 109 to 159 in 325f21c
Here are two cases in the approach I propose as an improvement:
apalache/tlair/src/test/scala/at/forsyte/apalache/tla/typecomp/TestBaseBuilder.scala
Lines 126 to 154 in de453fe
Benefits of my proposed approach:
The text was updated successfully, but these errors were encountered: