GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — AliceO2/Algorithm/test/o2formatparser.cxx at dev · nstrangm/AliceO2 Expand file tree/ Copy patho2formatparser.cxxMore file actions 82 lines (73 loc) · 3.01 KB / Copy patho2formatparser.cxxFile metadata and controls82 lines (73 loc) · 3.01 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 // Copyright 2019-2020 CERN and copyright holders of ALICE O2. // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. // All rights not expressly granted are reserved. // // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". // // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// @file o2formatparser.cxx /// @author Matthias Richter /// @since 2017-10-18 /// @brief Unit test for O2 format parser #define BOOST_TEST_MODULE Test Algorithm HeaderStack #define BOOST_TEST_MAIN #define BOOST_TEST_DYN_LINK #include <boost/test/unit_test.hpp> #include <iostream> #include <iomanip> #include <cstring> // memcmp #include "Headers/DataHeader.h" // hexdump, DataHeader #include "../include/Algorithm/O2FormatParser.h" template <typename... Targs> void hexDump(Targs... Fargs) { // a simple redirect to enable/disable the hexdump printout o2::header::hexDump(Fargs...); } BOOST_AUTO_TEST_CASE(test_o2formatparser) { std::vector<const char*> thedata = { "I'm raw data", "reconstructed data"}; unsigned dataidx = 0; std::vector<o2::header::DataHeader> dataheaders; dataheaders.emplace_back(o2::header::DataDescription("RAWDATA"), o2::header::DataOrigin("DET"), 0, strlen(thedata[dataidx++])); dataheaders.emplace_back(o2::header::DataDescription("RECODATA"), o2::header::DataOrigin("DET"), 0, strlen(thedata[dataidx++])); std::vector<std::pair<const char*, size_t>> messages; for (dataidx = 0; dataidx < thedata.size(); ++dataidx) { messages.emplace_back(reinterpret_cast<char*>(&dataheaders[dataidx]), sizeof(o2::header::DataHeader)); messages.emplace_back(thedata[dataidx], dataheaders[dataidx].payloadSize); } // handler callback for parseO2Format method auto insertFct = [&](const auto& dataheader, auto ptr, auto size) { hexDump("header", &dataheader, sizeof(dataheader)); hexDump("data", ptr, size); BOOST_CHECK(dataheader == dataheaders[dataidx]); BOOST_CHECK(strncmp(ptr, thedata[dataidx], size) == 0); ++dataidx; }; // end handler callback // handler callback to get the pointer for message auto getPointerFct = [](auto arg) { return arg.first; }; // handler callback to get the size for message auto getSizeFct = [](auto arg) { return arg.second; }; dataidx = 0; auto result = o2::algorithm::parseO2Format(messages, getPointerFct, getSizeFct, insertFct); BOOST_REQUIRE(result >= 0); BOOST_CHECK(result == 2); } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |