Files
mandy/tests/semantic/test_minmax_f32_payload.py
Vonsek e99017f99e test(shader): collect min/max NaN payload cases in semantic CI
The semantic CI job discovers tests with unittest. Run the numerical fixture there and retain compiled shader validation in the tool-backed pytest job.
2026-11-22 20:43:46 +01:00

23 lines
971 B
Python

"""Binary min/max with quiet NaNs, using the operand priority measured on gfx1030."""
import unittest
from pathlib import Path
from support import mrt0_words, translate_lines
class MinMaxPayloadTests(unittest.TestCase):
def test_minmax_f32_payload(self) -> None:
fixture = Path(__file__).with_name("fixtures") / "ps_minmax_f32_payload.asm"
module = translate_lines(fixture.stem, fixture.read_text(encoding="ascii").splitlines())
a, b, half = 0x7FE00080, 0xFFD10040, 0x3F000000
for lhs, rhs, expected in (
(a, b, (a, a, b, b)),
(a, half, (half, half, half, half)),
(half, b, (half, half, half, half)),
(0, 0x80000000, (0x80000000, 0, 0x80000000, 0)),
):
with self.subTest(lhs=hex(lhs), rhs=hex(rhs)):
words = mrt0_words(module, push_constants=[lhs, rhs] + [0] * 30)
self.assertEqual(words, [word ^ 0x40C00000 for word in expected])