From c5a3cdb757f9755d04a1de927a4114a8f9dd2960 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 28 Oct 2026 11:27:35 +0000 Subject: [PATCH] test_refinement_mrt: check force reads in executable text, not comments The block_collision.cuh header comment names the absent d_params.fx/fy read, which tripped the source-text assertion. Strip // comments first and also require the real d_params.omega read. Test-only; no kernel source change. Co-Authored-By: Claude Opus 5.5 --- tests/unit/test_refinement_mrt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_refinement_mrt.py b/tests/unit/test_refinement_mrt.py index 5a61a0d..fe683d0 100644 --- a/tests/unit/test_refinement_mrt.py +++ b/tests/unit/test_refinement_mrt.py @@ -1,5 +1,6 @@ """Host guards and source contract for MRT reuse in refined/blocked stepping (no CUDA).""" from pathlib import Path +import re import unittest from CelerisLab.config import LBMConfig @@ -34,8 +35,11 @@ class RefinementMRTHost(unittest.TestCase): self.assertIn("collide_srt(f, feq, forcing, omega);", block_collision) self.assertIn("#if COLLISION_MODEL == 2 || BLOCK_ROOT_BC == 2", block_collision) self.assertEqual(channel.count("block_collide(f);"), 1) + # Executable text only: the header comment explains the absent force read. + code = re.sub(r"//[^\n]*", "", channel + "\n" + block_collision) + self.assertIn("d_params.omega", code) for text in ("collide_mrt_unforced", "collide_dispatch(", "d_params.fx", "d_params.fy"): - self.assertNotIn(text, channel + "\n" + block_collision) + self.assertNotIn(text, code) for source in (blocks,): self.assertIn("(COLLISION_MODEL != 0 && COLLISION_MODEL != 2)", source) self.assertIn("USE_LES", source)