The challenge involves a simple calculator language representing expressions consisting of integers, their additions and divisions only, like 1 + (2 / 3).
The property being tested is that
- if we have no subterms of the form x / 0,
- then we can evaluate the expression without a zero division error.
This property is false, because we might have a term like 1 / (3 + -3), in which the divisor is not literally 0 but evaluates to 0.
One of the possible difficulties that might come up is the shrinking of recursive expressions.
Library | Code | Report |
---|---|---|
Americium | CalculatorSpec.scala | calculator.md |
Hypothesis | calculator.py | calculator.md |
jqwik | CalculatorProperties.java | calculator.md |
PropEr | calculator.erl | calculator.md |
fast-check | calculator.js | calculator.md |
CsCheck | ShrinkingChallengeTests.cs | calculator.md |
elm-test | Calculator.elm | calculator.md |