Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
graph_contract_matrix.H
Go to the documentation of this file.
1/*
2 Aleph_w
3
4 Data structures & Algorithms
5 version 2.0.0b
6 https://github.com/lrleon/Aleph-w
7
8 This file is part of Aleph-w library
9
10 Copyright (c) 2002-2026 Leandro Rabindranath Leon
11
12 Permission is hereby granted, free of charge, to any person obtaining a copy
13 of this software and associated documentation files (the "Software"), to deal
14 in the Software without restriction, including without limitation the rights
15 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 copies of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
18
19 The above copyright notice and this permission notice shall be included in all
20 copies or substantial portions of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 SOFTWARE.
29*/
30
43#ifndef ALEPH_TESTS_GRAPH_CONTRACT_MATRIX_H
44#define ALEPH_TESTS_GRAPH_CONTRACT_MATRIX_H
45
46#include <cstddef>
47#include <type_traits>
48#include <utility>
49
50#include <gtest/gtest.h>
51
52#include <tpl_graph.H>
53
54#include "graph_harness.H"
56
58{
60 constexpr int Hidden = 2;
61
63 const unsigned long Hidden_Mask = 1UL << Hidden;
64
66 template <class GT, class SA>
67 constexpr bool hides = not std::is_same_v<SA, Aleph::Dft_Show_Arc<GT>>;
68
75 template <class GT, class F>
76 void for_each_filter(F && f)
77 {
78 std::size_t calls = 0;
79 f(Aleph::Dft_Show_Arc<GT>(), "Dft_Show_Arc");
81 f(graph_filters::Counting<GT>{Hidden_Mask, &calls}, "Counting");
82 graph_harness::with_each_throw(f, graph_filters::make_capturing_lambda<GT>(Hidden_Mask), "Capturing_Lambda");
87 }
88
90 template <class GT, class F>
91 void for_each_constness(GT & g, F && f)
92 {
93 {
94 SCOPED_TRACE("GT &");
95 f(g);
96 }
97 {
98 SCOPED_TRACE("const GT &");
99 f(std::as_const(g));
100 }
101 }
102} // namespace graph_contract_matrix
103
104#endif // ALEPH_TESTS_GRAPH_CONTRACT_MATRIX_H
The kinds of arc filter and of distance that the graph algorithms must accept.
Every small multigraph, on every kind of graph, for the tests.
void for_each_filter(F &&f)
Calls f(sa, name) with a filter of each kind of the catalog of graph_filter_catalog....
void for_each_constness(GT &g, F &&f)
Calls f(g) with g as it is and as a const graph.
constexpr int Hidden
The number of the arc that the filters hide.
constexpr bool hides
Whether a filter of type SA hides the arc Hidden: all but Dft_Show_Arc.
const unsigned long Hidden_Mask
The mask of the filters: only the arc Hidden.
void with_each_throw(F &f, const Filt &filt, const char *name)
Calls f(filt, name), as the loop over the filters of a test does, and again for each call k of the fi...
Default filter for filtered iterators on arcs.
Definition tpl_graph.H:1024
A const member: default constructible, not assignable.
As Hide_Mask, and counts its calls through a pointer.
A std::deque member, whose move is not noexcept in libstdc++.
Hides the arcs of a mask; copyable, assignable, noexcept.
Keeps its mask by reference: neither assignable nor default constructible.
A hand-written copy that is not noexcept, which leaves the type without a move: std::move_if_noexcept...
Generic graph and digraph implementations.