GCC Code Coverage Report


Directory: ./
File: Mapping/LexiRouteRoutingMethod.cpp
Date: 2022-10-15 05:10:18
Exec Total Coverage
Lines: 15 15 100.0%
Functions: 5 5 100.0%
Branches: 7 14 50.0%
Decisions: 0 0 -%

Line Branch Decision Exec Source
1 // Copyright 2019-2022 Cambridge Quantum Computing
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 #include "Mapping/LexiRouteRoutingMethod.hpp"
16
17 namespace tket {
18
19 120 LexiRouteRoutingMethod::LexiRouteRoutingMethod(unsigned _max_depth)
20 120 : max_depth_(_max_depth){};
21
22 2750 std::pair<bool, unit_map_t> LexiRouteRoutingMethod::routing_method(
23 MappingFrontier_ptr& mapping_frontier,
24 const ArchitecturePtr& architecture) const {
25
1/2
✓ Branch 1 taken 2750 times.
✗ Branch 2 not taken.
2750 LexiRoute lr(architecture, mapping_frontier);
26
2/4
✓ Branch 1 taken 2750 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2750 times.
✗ Branch 6 not taken.
5500 return {lr.solve(this->max_depth_), {}};
27 2750 }
28
29 36 unsigned LexiRouteRoutingMethod::get_max_depth() const {
30 36 return this->max_depth_;
31 }
32
33 36 nlohmann::json LexiRouteRoutingMethod::serialize() const {
34 36 nlohmann::json j;
35
2/4
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 36 times.
✗ Branch 6 not taken.
36 j["depth"] = this->get_max_depth();
36
2/4
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 36 times.
✗ Branch 5 not taken.
36 j["name"] = "LexiRouteRoutingMethod";
37 36 return j;
38 }
39
40 8 LexiRouteRoutingMethod LexiRouteRoutingMethod::deserialize(
41 const nlohmann::json& j) {
42 8 return LexiRouteRoutingMethod(j.at("depth").get<unsigned>());
43 }
44
45 } // namespace tket
46