1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//! Check whether a digraph is a tournament.
//!
//! A tournament is a digraph in which there is one arc between every unordered
//! pair of distinct vertices.
//!
//! # Examples
//!
//! ```
//! use graaf::{
//! AdjacencyList,
//! Circuit,
//! Complete,
//! Empty,
//! IsTournament,
//! RandomTournament,
//! };
//!
//! assert!(!AdjacencyList::empty(3).is_tournament());
//! assert!(!AdjacencyList::complete(3).is_tournament());
//! assert!(AdjacencyList::circuit(3).is_tournament());
//! assert!(AdjacencyList::random_tournament(3, 0).is_tournament());
//! ```
/// Check whether a digraph is a tournament.
pub trait IsTournament {
/// Check whether the digraph is a tournament.
///
/// # Examples
///
/// ```
/// use graaf::{
/// AdjacencyList,
/// Circuit,
/// Complete,
/// Empty,
/// IsTournament,
/// RandomTournament,
/// };
///
/// assert!(!AdjacencyList::empty(3).is_tournament());
/// assert!(!AdjacencyList::complete(3).is_tournament());
/// assert!(AdjacencyList::circuit(3).is_tournament());
/// assert!(AdjacencyList::random_tournament(3, 0).is_tournament());
/// ```
#[must_use]
fn is_tournament(&self) -> bool;
}
/// `IsTournament` tests
#[macro_export]
macro_rules! test_is_tournament {
($fixture:path) => {
use $fixture::{
bang_jensen_34,
bang_jensen_94,
bang_jensen_196,
kattis_builddeps,
kattis_cantinaofbabel_1,
kattis_cantinaofbabel_2,
kattis_escapewallmaria_1,
kattis_escapewallmaria_2,
kattis_escapewallmaria_3,
};
#[test]
fn is_tournament_bang_jensen_196() {
assert!(!bang_jensen_196().is_tournament());
}
#[test]
fn is_tournament_bang_jensen_34() {
assert!(!bang_jensen_34().is_tournament());
}
#[test]
fn is_tournament_bang_jensen_94() {
assert!(!bang_jensen_94().is_tournament());
}
#[test]
fn is_tournament_kattis_builddeps() {
assert!(!kattis_builddeps().is_tournament());
}
#[test]
fn is_tournament_kattis_cantinaofbabel_1() {
assert!(!kattis_cantinaofbabel_1().is_tournament());
}
#[test]
fn is_tournament_kattis_cantinaofbabel_2() {
assert!(!kattis_cantinaofbabel_2().is_tournament());
}
#[test]
fn is_tournament_kattis_escapewallmaria_1() {
assert!(!kattis_escapewallmaria_1().is_tournament());
}
#[test]
fn is_tournament_kattis_escapewallmaria_2() {
assert!(!kattis_escapewallmaria_2().is_tournament());
}
#[test]
fn is_tournament_kattis_escapewallmaria_3() {
assert!(!kattis_escapewallmaria_3().is_tournament());
}
};
}