DetectorGraph  2.0
graphtestutils.hpp
Go to the documentation of this file.
1 // Copyright 2017 Nest Labs, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef DETECTORGRAPH_TEST_UTIL_MARKIITESTUTILS_HPP_
16 #define DETECTORGRAPH_TEST_UTIL_MARKIITESTUTILS_HPP_
17 
18 #include "graph.hpp"
19 #include "topicstate.hpp"
20 #include "detector.hpp"
21 
22 namespace DetectorGraph
23 {
24 
25 namespace GraphTestUtils
26 {
27 
28  /*
29  * These are quickhand utilities for composing unit tests
30  * for Detectors implemented using DetectorGraph
31  */
32 
33  void Flush(Graph& aGraph);
34 
35  template<class TTopic> void FlushAndPush(Graph& aGraph, const TTopic& aTopicState)
36  {
37  Flush(aGraph);
38  aGraph.PushData<TTopic>(aTopicState);
39  }
40 
41 #if !defined(BUILD_FEATURE_DETECTORGRAPH_CONFIG_LITE)
42  void PrintOutputs(Graph& aGraph);
43 #endif
44 
45 } // namespace GraphTestUtils
46 
47 } // namespace DetectorGraph
48 
49 #endif // DETECTORGRAPH_TEST_UTIL_MARKIITESTUTILS_HPP_
void PrintOutputs(Graph &aGraph)
Implements a graph of Topics & Detectors with Input/Output APIs.
Definition: graph.hpp:127
void PushData(const TTopicState &aTopicState)
Push data to a specific topic in the graph.
Definition: graph.hpp:187
void FlushAndPush(Graph &aGraph, const TTopic &aTopicState)