Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
PipelineHandlerFactoryTest.cpp
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 #include "cheetah/pipeline/test/PipelineHandlerFactoryTest.h"
25 #include "cheetah/pipeline/PipelineHandlerFactory.h"
26 #include "cheetah/pipeline/CheetahConfig.h"
27 #include "cheetah/pipeline/BeamConfig.h"
28 
29 namespace ska {
30 namespace cheetah {
31 namespace pipeline {
32 namespace test {
33 
34 
35 PipelineHandlerFactoryTest::PipelineHandlerFactoryTest()
36  : ::testing::Test()
37 {
38 }
39 
40 PipelineHandlerFactoryTest::~PipelineHandlerFactoryTest()
41 {
42 }
43 
44 void PipelineHandlerFactoryTest::SetUp()
45 {
46 }
47 
48 void PipelineHandlerFactoryTest::TearDown()
49 {
50 }
51 
52 TEST_F(PipelineHandlerFactoryTest, test_create)
53 {
54  pipeline::CheetahConfig<uint8_t> config;
55  BeamConfig<uint8_t> beam_config;
56  pipeline::PipelineHandlerFactory factory(config);
57  for(auto const& handler : factory.available() ) {
58  std::cout << "testing handler '" << handler << "'" << std::endl;
59  try {
60  auto type = factory.create(handler, beam_config);
61  ASSERT_NE( nullptr, type ) << handler;
62  delete type;
63  } catch (panda::Error) {}
64 
65  std::cout << "testing timed handler '" << handler << "'" << std::endl;
66  try {
67  auto timed_type = factory.create_timed(handler, beam_config);
68  ASSERT_NE( nullptr, timed_type ) << handler;
69  delete timed_type;
70  } catch (panda::Error) {}
71  }
72 }
73 
74 TEST_F(PipelineHandlerFactoryTest, test_tdas_config)
75 {
76  pipeline::CheetahConfig<uint8_t> config;
77  BeamConfig<uint8_t> beam_config;
78  pipeline::PipelineHandlerFactory factory(config);
79 
80  ASSERT_THROW(factory.create("Tdas", beam_config), panda::Error);
81 
82  // select the sift algo
83  config.sift_config().template config<sift::simple_sift::Config>().active(true);
84  // select the fldo algo
85  config.fldo_config().template config<fldo::cuda::Config>().active(true);
86 
87  pipeline::PipelineHandlerFactory newFactory(config);
88 
89  ASSERT_NO_THROW(auto type = newFactory.create("Tdas", beam_config); delete type);
90 }
91 
92 } // namespace test
93 } // namespace pipeline
94 } // namespace cheetah
95 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35