ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AuctioneerTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AuctioneerTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/unit_test.hpp>
10 
11 #include <vector>
12 
14 
15 namespace Acts {
16 namespace Test {
17 
18 BOOST_AUTO_TEST_CASE(AuctioneerTest_VoidAuctioneer) {
19  // Build arbitrary vector
20  std::array<int, 4> vecArb = {0, 2, -5, 4};
21  std::array<bool, 4> vecRes = {false, true, false, true};
22  // Let it run through auction
24  std::array<bool, 4> resultVa = va(vecArb);
25  // Test that vector did not change
26  BOOST_CHECK_EQUAL_COLLECTIONS(vecRes.begin(), vecRes.end(), resultVa.begin(),
27  resultVa.end());
28 }
29 
30 BOOST_AUTO_TEST_CASE(AuctioneerTest_FirstValidAuctioneer) {
31  // Build arbitrary vector
32  std::array<int, 4> vecArb = {0, 1, -2, 4};
33  // Let it run through auction
35  std::array<bool, 4> resultFva = fva(vecArb);
36  std::array<bool, 4> expected = {false, true, false, false};
37  // Test that vector did not change
38  BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(),
39  resultFva.begin(), resultFva.end());
40 }
41 
42 BOOST_AUTO_TEST_CASE(AuctioneerTest_HighestValidAuctioneer) {
43  // Build arbitrary vector
44  std::array<int, 4> vecArb = {0, 1, -2, 4};
45  // Let it run through auction
47  std::array<bool, 4> resultFva = fva(vecArb);
48  std::array<bool, 4> expected = {false, false, false, true};
49  // Test that vector did not change
50  BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(),
51  resultFva.begin(), resultFva.end());
52 }
53 } // namespace Test
54 } // namespace Acts