Skip to main content

adze_governance_matrix_core/
lib.rs

1//! Compatibility facade for the governance matrix core implementation.
2//!
3//! The actual implementation now lives in `adze-governance-matrix-core-impl` so
4//! façade crates can keep this historical crate name while downstream users are
5//! insulated from package reshuffling.
6
7#![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_impl::*;
15
16#[cfg(test)]
17mod tests {
18    use super::*;
19
20    #[test]
21    fn phase_variants_accessible() {
22        assert_ne!(BddPhase::Core, BddPhase::Runtime);
23    }
24
25    #[test]
26    fn governance_matrix_standard_has_scenarios() {
27        let profile = ParserFeatureProfile::current();
28        let matrix = BddGovernanceMatrix::standard(profile);
29        assert!(!matrix.scenarios.is_empty());
30    }
31
32    #[test]
33    fn governance_matrix_is_fully_implemented_check() {
34        let profile = ParserFeatureProfile::current();
35        let matrix = BddGovernanceMatrix::standard(profile);
36        // Just verify it runs without panic
37        let _ = matrix.is_fully_implemented();
38    }
39
40    #[test]
41    fn governance_matrix_report() {
42        let profile = ParserFeatureProfile::current();
43        let matrix = BddGovernanceMatrix::standard(profile);
44        let report = matrix.report("Matrix Core Test");
45        assert!(report.contains("Matrix Core Test"));
46    }
47
48    #[test]
49    fn bdd_progress_on_empty_slice() {
50        let (impl_count, total) = bdd_progress(BddPhase::Core, &[]);
51        assert_eq!(impl_count, 0);
52        assert_eq!(total, 0);
53    }
54
55    #[test]
56    fn snapshot_debug_format() {
57        let profile = ParserFeatureProfile::current();
58        let snap =
59            bdd_governance_snapshot(BddPhase::Runtime, GLR_CONFLICT_PRESERVATION_GRID, profile);
60        let debug = format!("{:?}", snap);
61        assert!(debug.contains("phase"));
62    }
63
64    #[test]
65    fn bdd_progress_report_contains_title() {
66        let profile = ParserFeatureProfile::current();
67        let report = bdd_progress_report_with_profile(
68            BddPhase::Core,
69            GLR_CONFLICT_PRESERVATION_GRID,
70            "Core Title",
71            profile,
72        );
73        assert!(report.contains("Core Title"));
74    }
75
76    #[test]
77    fn bdd_progress_status_line_format() {
78        let profile = ParserFeatureProfile::current();
79        let core_status =
80            bdd_progress_status_line(BddPhase::Core, GLR_CONFLICT_PRESERVATION_GRID, profile);
81        let runtime_status =
82            bdd_progress_status_line(BddPhase::Runtime, GLR_CONFLICT_PRESERVATION_GRID, profile);
83        assert!(core_status.starts_with("core:"));
84        assert!(runtime_status.starts_with("runtime:"));
85    }
86
87    #[test]
88    fn describe_backend_for_conflicts_non_empty() {
89        let desc = describe_backend_for_conflicts(ParserFeatureProfile::current());
90        assert!(!desc.is_empty());
91    }
92
93    #[test]
94    fn glr_conflict_fallback_is_accessible() {
95        assert!(!GLR_CONFLICT_FALLBACK.is_empty());
96    }
97
98    #[test]
99    fn governance_snapshot_is_fully_implemented_check() {
100        let snap = BddGovernanceSnapshot {
101            phase: BddPhase::Core,
102            implemented: 5,
103            total: 5,
104            profile: ParserFeatureProfile::current(),
105        };
106        assert!(snap.is_fully_implemented());
107
108        let partial = BddGovernanceSnapshot {
109            phase: BddPhase::Core,
110            implemented: 3,
111            total: 5,
112            profile: ParserFeatureProfile::current(),
113        };
114        assert!(!partial.is_fully_implemented());
115    }
116
117    #[test]
118    fn governance_matrix_status_line_non_empty() {
119        let profile = ParserFeatureProfile::current();
120        let matrix = BddGovernanceMatrix::standard(profile);
121        assert!(!matrix.status_line().is_empty());
122    }
123}