1 /*
2  * Copyright 2014 Google Inc. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef FRUIT_COMMON_H
18 #define FRUIT_COMMON_H
19 
20 // This file includes headers used in various tests.
21 // This allows to improve compilation speed (and therefore test time) by pre-compiling this header.
22 
23 #include "class_construction_tracker.h"
24 #include "test_macros.h"
25 #include <fruit/fruit.h>
26 #include <fruit/impl/injector/injector_accessor_for_tests.h>
27 #include <map>
28 #include <vector>
29 
30 // These are here because including Boost in test code would require depending on its headers but those files don't have
31 // public visibility in the bazel repo.
32 #include <fruit/impl/data_structures/semistatic_graph.h>
33 using Graph = fruit::impl::SemistaticGraph<int, const char*>;
34 using node_iterator = Graph::node_iterator;
35 using edge_iterator = Graph::edge_iterator;
36 struct SimpleNode {
37   int id;
38   const char* value;
39   const std::vector<int>* neighbors;
40   bool is_terminal;
41 
getIdSimpleNode42   int getId() { return id; }
getValueSimpleNode43   const char* getValue() { return value; }
isTerminalSimpleNode44   bool isTerminal() { return is_terminal; }
getEdgesBeginSimpleNode45   std::vector<int>::const_iterator getEdgesBegin() { return neighbors->begin(); }
getEdgesEndSimpleNode46   std::vector<int>::const_iterator getEdgesEnd() { return neighbors->end(); }
47 };
48 
49 #endif // FRUIT_COMMON_H
50