00001 #define BOOST_TEST_MODULE ( NoOp_policy_t ) 00002 #include <boost/test/auto_unit_test.hpp> 00003 00004 #include "artdaq/Application/Routing/makeRoutingMasterPolicy.hh" 00005 #include "fhiclcpp/ParameterSet.h" 00006 #include "fhiclcpp/make_ParameterSet.h" 00007 00008 00009 BOOST_AUTO_TEST_SUITE(NoOp_policy_t) 00010 00011 BOOST_AUTO_TEST_CASE(Simple) 00012 { 00013 fhicl::ParameterSet ps; 00014 fhicl::make_ParameterSet("receiver_ranks: [1,2,3,4]", ps); 00015 00016 auto noop = artdaq::makeRoutingMasterPolicy("NoOp", ps); 00017 00018 BOOST_REQUIRE_EQUAL(noop->GetReceiverCount(), 4); 00019 00020 noop->Reset(); 00021 noop->AddReceiverToken(1,1); 00022 noop->AddReceiverToken(3, 1); 00023 noop->AddReceiverToken(2, 1); 00024 noop->AddReceiverToken(4, 1); 00025 noop->AddReceiverToken(2, 1); 00026 auto secondTable = noop->GetCurrentTable(); 00027 BOOST_REQUIRE_EQUAL(secondTable.size(), 5); 00028 BOOST_REQUIRE_EQUAL(secondTable[0].destination_rank, 1); 00029 BOOST_REQUIRE_EQUAL(secondTable[1].destination_rank, 3); 00030 BOOST_REQUIRE_EQUAL(secondTable[2].destination_rank, 2); 00031 BOOST_REQUIRE_EQUAL(secondTable[3].destination_rank, 4); 00032 BOOST_REQUIRE_EQUAL(secondTable[4].destination_rank, 2); 00033 BOOST_REQUIRE_EQUAL(secondTable[0].sequence_id, 0); 00034 BOOST_REQUIRE_EQUAL(secondTable[1].sequence_id, 1); 00035 BOOST_REQUIRE_EQUAL(secondTable[2].sequence_id, 2); 00036 BOOST_REQUIRE_EQUAL(secondTable[3].sequence_id, 3); 00037 BOOST_REQUIRE_EQUAL(secondTable[4].sequence_id, 4); 00038 00039 noop->AddReceiverToken(1, 0); 00040 00041 auto thirdTable = noop->GetCurrentTable(); 00042 BOOST_REQUIRE_EQUAL(thirdTable.size(), 0); 00043 } 00044 00045 BOOST_AUTO_TEST_SUITE_END()