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