@@ -1124,6 +1124,34 @@ BOOST_AUTO_TEST_CASE(FullMFTRefitLegUsesNominalMaterialAtEverySurface)
11241124
11251125// --- 10/11: chi2-gate failure and atomicity ----------------------------------
11261126
1127+ BOOST_AUTO_TEST_CASE (NegativeMeasurementVarianceFailsTransactionally)
1128+ {
1129+ for (const bool forward : {false , true }) {
1130+ for (const bool negativeU : {false , true }) {
1131+ // Cover both a negative residual variance and a small invalid measurement
1132+ // variance hidden by the positive track covariance.
1133+ for (const float variance : {-1 .f , -1 .e -6f }) {
1134+ BOOST_TEST_CONTEXT (" forward=" << forward << " , negativeU=" << negativeU << " , variance=" << variance)
1135+ {
1136+ auto state = forward ? diskState () : barrelState ();
1137+ const auto before = state;
1138+ auto measurement = forward ? diskMeasurement () : barrelMeasurement ();
1139+ (negativeU ? measurement.covariance .uu : measurement.covariance .vv ) = variance;
1140+ float chi2 = 123 .f ;
1141+
1142+ BOOST_CHECK (!(forward ? Propagator::predictedChi2Forward (state, measurement, chi2)
1143+ : Propagator::predictedChi2Barrel (state, measurement, chi2)));
1144+ BOOST_CHECK_EQUAL (chi2, 123 .f );
1145+ BOOST_CHECK (!(forward ? Propagator::updateForward (state, measurement, chi2)
1146+ : Propagator::updateBarrel (state, measurement, chi2)));
1147+ BOOST_CHECK (bitEqual (state, before));
1148+ BOOST_CHECK_EQUAL (chi2, 123 .f );
1149+ }
1150+ }
1151+ }
1152+ }
1153+ }
1154+
11271155BOOST_AUTO_TEST_CASE (Chi2GateRejectsOversizedPredictedChi2Transactionally)
11281156{
11291157 auto state = barrelState ();
0 commit comments