diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2930b5..3a1e0df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,10 @@ jobs: - name: Install WitnessLint run: | - git clone --depth 1 https://gitlab.com/sosy-lab/benchmarking/sv-witnesses.git "$RUNNER_TEMP/sv-witnesses" + # WitnessLint 2.4 ("Release 2.4"), the version SV-COMP 2027 validates with. master has + # unreleased checks (e.g. rejecting witnesses without a target waypoint). + git clone https://gitlab.com/sosy-lab/benchmarking/sv-witnesses.git "$RUNNER_TEMP/sv-witnesses" + git -C "$RUNNER_TEMP/sv-witnesses" checkout --quiet 28d273853e11cfeb0ddc7ef26f84f2a3c6fd2d20 python -m pip install -r "$RUNNER_TEMP/sv-witnesses/linter/requirements.txt" echo "WITNESSLINT=python $RUNNER_TEMP/sv-witnesses/linter/witnesslinter.py" >> "$GITHUB_ENV" diff --git a/src/witnesscreator/_version.py b/src/witnesscreator/_version.py index 6849410..a82b376 100644 --- a/src/witnesscreator/_version.py +++ b/src/witnesscreator/_version.py @@ -1 +1 @@ -__version__ = "1.1.0" +__version__ = "1.1.1" diff --git a/src/witnesscreator/literals.py b/src/witnesscreator/literals.py index c9930a5..73ac5d2 100644 --- a/src/witnesscreator/literals.py +++ b/src/witnesscreator/literals.py @@ -140,7 +140,10 @@ def floating_constraint(value: str, is_float: bool) -> str: box = "Float" if is_float else "Double" v = value.strip() if v == "NaN": - return f"{box}.isNaN({RESULT})" + # NaN is the only value not equal to itself. Validators that read a single + # value from the constraint (e.g. JLiSA-Wit) accept this form but not + # ``Float.isNaN(\result)``; ``\result == Float.NaN`` would be always false. + return f"{RESULT} != {RESULT}" if v == "Infinity": return f"{RESULT} == {box}.POSITIVE_INFINITY" if v == "-Infinity": diff --git a/tests/test_e2e.py b/tests/test_e2e.py index 6cff729..1fd36cb 100644 --- a/tests/test_e2e.py +++ b/tests/test_e2e.py @@ -92,7 +92,7 @@ def test_float_special_values(tmp_path, witnesslint): entry, (_, _, edges) = write(task_for(task_dir), values, violation, tmp_path) wps = waypoints(entry) assert [wp["constraint"]["value"] for wp in wps[:-1]] == [ - "\\result == Float.NEGATIVE_INFINITY", "Float.isNaN(\\result)", "\\result == -0.0f", + "\\result == Float.NEGATIVE_INFINITY", "\\result != \\result", "\\result == -0.0f", "\\result == Float.POSITIVE_INFINITY", "\\result == 10000000000.0f", "\\result == -0.0012512209359556437f", "\\result == 0.10000000149011612f", ] diff --git a/tests/test_literals.py b/tests/test_literals.py index b904d4a..8820d7c 100644 --- a/tests/test_literals.py +++ b/tests/test_literals.py @@ -56,8 +56,8 @@ def test_floating_point(): assert result_constraint("-0.0", "D") == "\\result == -0.0" assert result_constraint("-0.0", "F") == "\\result == -0.0f" assert result_constraint("10000000000", "D") == "\\result == 10000000000.0" - assert result_constraint("NaN", "float") == "Float.isNaN(\\result)" - assert result_constraint("NaN", "D") == "Double.isNaN(\\result)" + assert result_constraint("NaN", "float") == "\\result != \\result" + assert result_constraint("NaN", "D") == "\\result != \\result" assert result_constraint("Infinity", "double") == "\\result == Double.POSITIVE_INFINITY" assert result_constraint("-Infinity", "float") == "\\result == Float.NEGATIVE_INFINITY" assert result_constraint("1.5f", "F") == "\\result == 1.5f"