Skip to main content

qubit_fs_testkit/
contract_check_outcome.rs

1// =============================================================================
2//    Copyright (c) 2026 Haixing Hu.
3//
4//    SPDX-License-Identifier: Apache-2.0
5//
6//    Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Outcomes recorded by filesystem contract checks.
9
10/// The observable result of one stable contract check.
11///
12/// # Examples
13///
14/// ```
15/// use qubit_fs_testkit::ContractCheckOutcome;
16///
17/// let outcome = ContractCheckOutcome::NotApplicable {
18///     reason: "provider does not expose server-side copy".to_owned(),
19/// };
20/// assert!(matches!(outcome, ContractCheckOutcome::NotApplicable { .. }));
21/// ```
22#[must_use]
23#[non_exhaustive]
24#[derive(Clone, Debug, Eq, PartialEq)]
25pub enum ContractCheckOutcome {
26    /// The provider satisfied the check.
27    Passed,
28    /// The provider rejected a request that the contract requires it to reject.
29    RejectedAsExpected,
30    /// The check does not apply to this fixture or provider configuration.
31    NotApplicable {
32        /// Why this provider or fixture does not expose the scenario.
33        reason: String,
34    },
35    /// The check could not be verified from the fixture's available evidence.
36    Unverified {
37        /// Why the suite could not produce independent evidence.
38        reason: String,
39    },
40    /// An optional diagnostic probe was unavailable.
41    SkippedOptional {
42        /// Why an optional diagnostic probe was unavailable.
43        reason: String,
44    },
45    /// The executed check violated a contract or its fixture failed.
46    Failed {
47        /// A diagnostic describing the failed assertion or operation.
48        reason: String,
49    },
50    /// Execution ended before this registered check could run.
51    NotRun {
52        /// Why execution did not reach this check.
53        reason: String,
54    },
55}