From 5f315fa65c146f33401682a9954ad27f81f0ba20 Mon Sep 17 00:00:00 2001
From: Marco Clemencic <marco.clemencic@cern.ch>
Date: Wed, 29 Sep 2021 10:05:04 +0200
Subject: [PATCH] Fix ODIN 7 to ODIN 6 compatibility test

---
 Event/DAQEvent/tests/src/test_ODIN_codecs.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Event/DAQEvent/tests/src/test_ODIN_codecs.cpp b/Event/DAQEvent/tests/src/test_ODIN_codecs.cpp
index 6e8bcbdb691..d860aa892c3 100644
--- a/Event/DAQEvent/tests/src/test_ODIN_codecs.cpp
+++ b/Event/DAQEvent/tests/src/test_ODIN_codecs.cpp
@@ -52,6 +52,9 @@ BOOST_AUTO_TEST_CASE( version_7_stability ) {
 BOOST_AUTO_TEST_CASE( version_6_stability ) {
   // ODIN -> raw 6 -> ODIN -> raw 6
   LHCb::ODIN odin{random_bits};
+  // We can convert to version 6 only if trigger and calibration types fit
+  odin.setTriggerType( odin.triggerType() & 0x7 );         // make sure the trigger type fits 3 bits
+  odin.setCalibrationType( odin.calibrationType() & 0x3 ); // make sure the calibration type fits 2 bits
 
   std::array<std::uint32_t, 10> raw6_1{0};
   odin.to_version<6>( raw6_1 );
@@ -65,6 +68,9 @@ BOOST_AUTO_TEST_CASE( version_6_stability ) {
 BOOST_AUTO_TEST_CASE( zero_unused_bits_in_v6 ) {
   // zeroing unused bits in conversion
   LHCb::ODIN odin{random_bits};
+  // We can convert to version 6 only if trigger and calibration types fit
+  odin.setTriggerType( odin.triggerType() & 0x7 );         // make sure the trigger type fits 3 bits
+  odin.setCalibrationType( odin.calibrationType() & 0x3 ); // make sure the calibration type fits 2 bits
 
   std::array<std::uint32_t, 10> raw6_1{0};
   odin.to_version<6>( raw6_1 );
-- 
GitLab