Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
SiftTester.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_SIFT_TEST_SIFTTESTER_H
25 #define SKA_CHEETAH_SIFT_TEST_SIFTTESTER_H
26 
27 #include "cheetah/sift/Config.h"
28 #include "cheetah/sift/Sift.h"
29 #include "cheetah/utils/test_utils/AlgorithmTester.h"
30 #include "panda/AlgorithmInfo.h"
31 #include "panda/test/TestHandler.h"
32 
33 #include <gtest/gtest.h>
34 #include <memory>
35 
36 namespace ska {
37 namespace cheetah {
38 namespace sift {
39 namespace test {
40 
71 template<typename SiftAlgo>
72 struct SiftTesterTraits : public utils::test::PoolAlgorithmTesterTraits<typename SiftAlgo::Architecture
73  , typename panda::AlgorithmInfo<SiftAlgo>::ArchitectureCapability>
74 {
75  private:
76  typedef utils::test::PoolAlgorithmTesterTraits<typename SiftAlgo::Architecture
77  , typename panda::AlgorithmInfo<SiftAlgo>::ArchitectureCapability> BaseT;
78 
79  public:
80  typedef typename BaseT::PoolType PoolType;
81 
82  private:
83  struct SiftHandler : public panda::test::TestHandler
84  {
85  private:
86  typedef panda::test::TestHandler BaseT;
87 
88  public:
89  SiftHandler() = default;
90  SiftHandler(SiftHandler const&) = delete;
91 
92  void operator()(std::shared_ptr<data::Scl>);
93  std::shared_ptr<data::Scl> const& data() const { return _data; }
94 
95  private:
96  std::shared_ptr<data::Scl> _data;
97  };
98 
99  struct TestConfig : public sift::Config
100  {
101  typedef typename SiftTesterTraits::PoolType PoolType;
102 
103  public:
104  TestConfig() : _pool(nullptr)
105  {
106  deactivate_all();
107  }
108  PoolType& pool() const { assert(_pool); return *_pool; }
109  void pool(PoolType& pool) { _pool = &pool; }
110 
111  protected:
112  PoolType* _pool;
113  };
114 
115  public:
117 
118  public:
119  SiftTesterTraits() = default;
120  Api& api(PoolType&);
121  TestConfig& config();
122  SiftHandler& handler();
123 
124  private:
125  TestConfig _config;
126  SiftHandler _handler;
127  std::unique_ptr<Api> _api;
128 };
129 
130 template <typename TestTraits>
132 {
133  protected:
134  void SetUp();
135  void TearDown();
136 
137  public:
138  SiftTester();
139  ~SiftTester();
140 
141  private:
142 };
143 
144 TYPED_TEST_CASE_P(SiftTester);
145 
146 } // namespace test
147 } // namespace sift
148 } // namespace cheetah
149 } // namespace ska
150 
151 #include "cheetah/sift/test_utils/detail/SiftTester.cpp"
152 
153 #endif // SKA_CHEETAH_SIFT_TEST_SIFTTESTER_H
Some limits and constants for FLDO.
Definition: Brdz.h:35
Configuration for the sift module.
Definition: Config.h:39
Base class for generic algortihm tests that require an accelerator device.
Top level sync + async mixed interface for Sift module.
Definition: Sift.h:55