Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
FldoTester.h
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef SKA_CHEETAH_FLDO_TEST_UTILS_FLDOTESTER_H
25 #define SKA_CHEETAH_FLDO_TEST_UTILS_FLDOTESTER_H
26 
27 #include "cheetah/fldo/Fldo.h"
28 #include "cheetah/utils/test_utils/AlgorithmTester.h"
29 #include "panda/AlgorithmInfo.h"
30 #include "panda/test/TestHandler.h"
31 #include <gtest/gtest.h>
32 
33 namespace ska {
34 namespace cheetah {
35 namespace fldo {
36 namespace test {
37 
66 template<class FldoAlgo>
67 class FldoTesterTraits : public utils::test::PoolAlgorithmTesterTraits<typename panda::AlgorithmInfo<FldoAlgo>::Architecture
68  ,typename panda::AlgorithmInfo<FldoAlgo>::ArchitectureCapability>
69 {
70  private:
71  typedef utils::test::PoolAlgorithmTesterTraits<typename FldoAlgo::Architecture
72  , typename panda::AlgorithmInfo<FldoAlgo>::ArchitectureCapability> BaseT;
73  public:
74  typedef typename BaseT::PoolType PoolType;
75  typedef std::shared_ptr<data::Ocld> ResultType;
76 
77  private:
78  struct FldoHandler : public panda::test::TestHandler
79  {
80  typedef panda::test::TestHandler BaseT;
81 
82  public:
83  FldoHandler()
84  : BaseT(false)
85  {}
86  void operator()(ResultType data) { _data = data; BaseT::operator()(); }
87  ResultType const& data() const { return _data; }
88 
89  private:
90  ResultType _data;
91  };
92 
93  struct TestConfig : public fldo::Config
94  {
95  typedef typename FldoTesterTraits::PoolType PoolType;
96 
97  public:
98  TestConfig()
99  : _pool(nullptr)
100  {
101  deactivate_all();
102  }
103 
104  PoolType& pool() const { assert(_pool); return *_pool; }
105  void pool(PoolType& pool) { _pool = &pool; }
106 
107  protected:
108  PoolType* _pool;
109  };
110 
111  public:
112  typedef typename FldoAlgo::Traits::TimeFrequencyType TimeFrequencyType;
113  typedef typename TimeFrequencyType::value_type NumericalRep;
114 
116 
117  public:
118  Api& api(PoolType&);
119  FldoHandler& handler();
120 
121  private:
122  TestConfig _config;
123  FldoHandler _handler;
124  std::unique_ptr<Api> _api;
125 };
126 
127 
128 template <typename TestTraits>
130 {
132 
133  protected:
134  void SetUp();
135  void TearDown();
136 
137  public:
138  FldoTester();
139  ~FldoTester();
140 
141  private:
142 };
143 
144 TYPED_TEST_CASE_P(FldoTester);
145 
146 } // namespace test
147 } // namespace fldo
148 } // namespace cheetah
149 } // namespace ska
150 #include "cheetah/fldo/test_utils/detail/FldoTester.cpp"
151 
152 
153 #endif // SKA_CHEETAH_FLDO_TEST_UTILS_FLDOTESTER_H
The FLDO primary API.
Definition: Fldo.h:54
Some limits and constants for FLDO.
Definition: Brdz.h:35
Base class for generic algortihm tests that require an accelerator device.
Configuration details for the fldo module.
Definition: Config.h:51