adze_governance_matrix_contract/
lib.rs1#![forbid(unsafe_op_in_unsafe_fn)]
8#![deny(missing_docs)]
9#![cfg_attr(feature = "strict_api", deny(unreachable_pub))]
10#![cfg_attr(not(feature = "strict_api"), warn(unreachable_pub))]
11#![cfg_attr(feature = "strict_docs", deny(missing_docs))]
12#![cfg_attr(not(feature = "strict_docs"), allow(missing_docs))]
13
14pub use adze_governance_matrix_core::{
15 BddGovernanceMatrix, BddGovernanceSnapshot, BddPhase, BddScenario, BddScenarioStatus,
16 GLR_CONFLICT_FALLBACK, GLR_CONFLICT_PRESERVATION_GRID, ParserBackend, ParserFeatureProfile,
17 bdd_governance_snapshot, bdd_progress, bdd_progress_report, bdd_progress_report_with_profile,
18 bdd_progress_status_line, describe_backend_for_conflicts,
19};
20
21#[cfg(test)]
22mod tests {
23 use super::*;
24
25 #[test]
26 fn snapshot_debug_and_clone() {
27 let profile = ParserFeatureProfile::current();
28 let snap = bdd_governance_snapshot(BddPhase::Core, GLR_CONFLICT_PRESERVATION_GRID, profile);
29 let cloned = snap;
30 assert_eq!(snap, cloned);
31 let debug = format!("{:?}", snap);
32 assert!(debug.contains("BddGovernanceSnapshot"));
33 }
34
35 #[test]
36 fn snapshot_non_conflict_backend() {
37 let snap = BddGovernanceSnapshot {
38 phase: BddPhase::Core,
39 implemented: 5,
40 total: 5,
41 profile: ParserFeatureProfile::current(),
42 };
43 let backend = snap.non_conflict_backend();
44 let _ = backend.name();
45 }
46
47 #[test]
48 fn glr_conflict_fallback_is_descriptive() {
49 assert!(GLR_CONFLICT_FALLBACK.contains("GLR") || GLR_CONFLICT_FALLBACK.contains("glr"));
50 }
51
52 #[test]
53 fn describe_backend_returns_string() {
54 let desc = describe_backend_for_conflicts(ParserFeatureProfile::current());
55 assert!(!desc.is_empty());
56 }
57
58 #[test]
59 fn matrix_new_constructor() {
60 let profile = ParserFeatureProfile::current();
61 let matrix =
62 BddGovernanceMatrix::new(BddPhase::Runtime, profile, GLR_CONFLICT_PRESERVATION_GRID);
63 assert_eq!(matrix.phase, BddPhase::Runtime);
64 assert_eq!(matrix.profile, profile);
65 }
66
67 #[test]
68 fn matrix_snapshot_round_trip() {
69 let profile = ParserFeatureProfile::current();
70 let matrix = BddGovernanceMatrix::standard(profile);
71 let snap = matrix.snapshot();
72 assert_eq!(snap.phase, BddPhase::Core);
73 assert_eq!(snap.total, GLR_CONFLICT_PRESERVATION_GRID.len());
74 }
75
76 #[test]
77 fn matrix_status_line_nonempty() {
78 let profile = ParserFeatureProfile::current();
79 let matrix = BddGovernanceMatrix::standard(profile);
80 assert!(!matrix.status_line().is_empty());
81 }
82
83 #[test]
84 fn bdd_progress_on_empty_scenarios() {
85 let (implemented, total) = bdd_progress(BddPhase::Core, &[]);
86 assert_eq!(implemented, 0);
87 assert_eq!(total, 0);
88 }
89
90 #[test]
91 fn bdd_progress_on_standard_grid() {
92 let (implemented, total) = bdd_progress(BddPhase::Core, GLR_CONFLICT_PRESERVATION_GRID);
93 assert!(total > 0);
94 assert!(implemented <= total);
95 }
96
97 #[test]
98 fn bdd_progress_report_format() {
99 let report = bdd_progress_report(
100 BddPhase::Core,
101 GLR_CONFLICT_PRESERVATION_GRID,
102 "Contract Report",
103 );
104 assert!(report.contains("Contract Report"));
105 }
106
107 #[test]
108 fn bdd_progress_report_with_profile_format() {
109 let profile = ParserFeatureProfile::current();
110 let report = bdd_progress_report_with_profile(
111 BddPhase::Runtime,
112 GLR_CONFLICT_PRESERVATION_GRID,
113 "Runtime Contract",
114 profile,
115 );
116 assert!(report.contains("Runtime Contract"));
117 }
118
119 #[test]
120 fn bdd_progress_status_line_phase_prefix() {
121 let profile = ParserFeatureProfile::current();
122 let core =
123 bdd_progress_status_line(BddPhase::Core, GLR_CONFLICT_PRESERVATION_GRID, profile);
124 let runtime =
125 bdd_progress_status_line(BddPhase::Runtime, GLR_CONFLICT_PRESERVATION_GRID, profile);
126 assert!(core.starts_with("core:"));
127 assert!(runtime.starts_with("runtime:"));
128 }
129
130 #[test]
131 fn snapshot_copy_semantics() {
132 let snap = BddGovernanceSnapshot {
133 phase: BddPhase::Core,
134 implemented: 3,
135 total: 5,
136 profile: ParserFeatureProfile::current(),
137 };
138 let copied = snap;
139 assert_eq!(snap, copied);
140 }
141}