Skip to main content

qualia_core_db/net/qdnf/harness/scenarios/
table.rs

1//! Scenario identifiers and observational fixture flags.
2
3/// Blueprint acceptance scenario (sensitive-operations S01–S40).
4#[repr(u8)]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum ScenarioId {
7    S01 = 1,
8    S02 = 2,
9    S03 = 3,
10    S04 = 4,
11    S05 = 5,
12    S06 = 6,
13    S07 = 7,
14    S08 = 8,
15    S09 = 9,
16    S10 = 10,
17    S11 = 11,
18    S12 = 12,
19    S13 = 13,
20    S14 = 14,
21    S15 = 15,
22    S16 = 16,
23    S17 = 17,
24    S18 = 18,
25    S19 = 19,
26    S20 = 20,
27    S21 = 21,
28    S22 = 22,
29    S23 = 23,
30    S24 = 24,
31    S25 = 25,
32    S26 = 26,
33    S27 = 27,
34    S28 = 28,
35    S29 = 29,
36    S30 = 30,
37    S31 = 31,
38    S32 = 32,
39    S33 = 33,
40    S34 = 34,
41    S35 = 35,
42    S36 = 36,
43    S37 = 37,
44    S38 = 38,
45    S39 = 39,
46    S40 = 40,
47}
48
49/// One matrix row. `qualified` stays false until E21 release evidence exists.
50#[derive(Clone, Copy, Debug, PartialEq, Eq)]
51pub struct ScenarioStatus {
52    pub implemented_fixture: bool,
53    pub qualified: bool,
54}
55
56const fn row(fixture: bool) -> ScenarioStatus {
57    ScenarioStatus {
58        implemented_fixture: fixture,
59        qualified: false,
60    }
61}
62
63/// Every row has an observational fixture. Qualified remains false.
64const TABLE: [ScenarioStatus; 40] = [row(true); 40];
65
66impl ScenarioId {
67    pub const MIN: u8 = 1;
68    pub const MAX: u8 = 40;
69    pub const COUNT: usize = 40;
70
71    /// Builds `ScenarioId` from `u8`.
72    pub const fn from_u8(n: u8) -> Option<Self> {
73        match n {
74            1 => Some(Self::S01),
75            2 => Some(Self::S02),
76            3 => Some(Self::S03),
77            4 => Some(Self::S04),
78            5 => Some(Self::S05),
79            6 => Some(Self::S06),
80            7 => Some(Self::S07),
81            8 => Some(Self::S08),
82            9 => Some(Self::S09),
83            10 => Some(Self::S10),
84            11 => Some(Self::S11),
85            12 => Some(Self::S12),
86            13 => Some(Self::S13),
87            14 => Some(Self::S14),
88            15 => Some(Self::S15),
89            16 => Some(Self::S16),
90            17 => Some(Self::S17),
91            18 => Some(Self::S18),
92            19 => Some(Self::S19),
93            20 => Some(Self::S20),
94            21 => Some(Self::S21),
95            22 => Some(Self::S22),
96            23 => Some(Self::S23),
97            24 => Some(Self::S24),
98            25 => Some(Self::S25),
99            26 => Some(Self::S26),
100            27 => Some(Self::S27),
101            28 => Some(Self::S28),
102            29 => Some(Self::S29),
103            30 => Some(Self::S30),
104            31 => Some(Self::S31),
105            32 => Some(Self::S32),
106            33 => Some(Self::S33),
107            34 => Some(Self::S34),
108            35 => Some(Self::S35),
109            36 => Some(Self::S36),
110            37 => Some(Self::S37),
111            38 => Some(Self::S38),
112            39 => Some(Self::S39),
113            40 => Some(Self::S40),
114            _ => None,
115        }
116    }
117
118    #[inline]
119    /// Encodes as u8.
120    pub const fn as_u8(self) -> u8 {
121        self as u8
122    }
123}
124
125/// Status of a scenario.
126pub fn scenario_status(id: ScenarioId) -> ScenarioStatus {
127    TABLE[(id as u8 as usize) - 1]
128}
129
130/// Full scenario table.
131pub fn scenario_table() -> &'static [ScenarioStatus; 40] {
132    &TABLE
133}
134
135/// Count of rows with an implemented (unqualified) fixture.
136pub fn implemented_fixture_count() -> usize {
137    let mut n = 0usize;
138    let mut i = 0usize;
139    while i < TABLE.len() {
140        if TABLE[i].implemented_fixture {
141            n = n.saturating_add(1);
142        }
143        i = i.saturating_add(1);
144    }
145    n
146}
147
148/// Always zero. Qualification is not inferred from fixtures or test counts.
149pub fn qualified_count() -> usize {
150    0
151}