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
//! Return the number of vertices in a digraph.
//!
//! # Examples
//!
//! ```
//! use graaf::{
//! AdjacencyList,
//! Empty,
//! Order,
//! };
//!
//! let digraph = AdjacencyList::empty(4);
//!
//! assert_eq!(digraph.order(), 4);
//! ```
/// Digraph order
pub trait Order {
/// Count the vertices in the digraph.
///
/// # Examples
///
/// ```
/// use graaf::{
/// AdjacencyList,
/// Empty,
/// Order,
/// };
///
/// let digraph = AdjacencyList::empty(4);
///
/// assert_eq!(digraph.order(), 4);
/// ```
#[must_use]
fn order(&self) -> usize;
}
/// `Order` tests
#[macro_export]
macro_rules! test_order {
($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 order_bang_jensen_196() {
assert_eq!(bang_jensen_196().order(), 8);
}
#[test]
fn order_bang_jensen_34() {
assert_eq!(bang_jensen_34().order(), 6);
}
#[test]
fn order_bang_jensen_94() {
assert_eq!(bang_jensen_94().order(), 7);
}
#[test]
fn order_kattis_builddeps() {
assert_eq!(kattis_builddeps().order(), 6);
}
#[test]
fn order_kattis_cantinaofbabel_1() {
assert_eq!(kattis_cantinaofbabel_1().order(), 12);
}
#[test]
fn order_kattis_cantinaofbabel_2() {
assert_eq!(kattis_cantinaofbabel_2().order(), 12);
}
#[test]
fn order_kattis_escapewallmaria_1() {
assert_eq!(kattis_escapewallmaria_1().order(), 16);
}
#[test]
fn order_kattis_escapewallmaria_2() {
assert_eq!(kattis_escapewallmaria_2().order(), 16);
}
#[test]
fn order_kattis_escapewallmaria_3() {
assert_eq!(kattis_escapewallmaria_3().order(), 16);
}
};
}