image.domain\self_evolve\evolve_types.mbt
50% · 5 / 10 points · 146 linesBackground color reports the state of each line. Underlined characters mark exact instrumented byte offsets; hover them to inspect the visit count.
- 1
///| - 2
/// # 进化 self_evolve/evolve_types - 3
/// - 4
/// 图像处理库子模块 - 5
/// 图像处理库子模块 Image processing library submodule - 6
// self_evolve 类型定义 — 自动测试用例生成 + 退化场景发现 - 7
// Type definitions for self-evolution: auto test generation + degradation detection - 8
- 9
///| - 10
/// 测试用例类别。 - 11
/// 描述 Test case category. - 12
/// `#non_exhaustive` 表示未来可能添加新构造器 - 13
#derive(Eq, @debug.Debug) - 14
#non_exhaustive - 15
pub(all) enum TestCategory { - 16
Boundary // 边界条件(零尺寸/最小尺寸/最大尺寸) - 17
Normal // 正常用例 - 18
EdgeCase // 边缘用例(极端参数) - 19
Degradation // 退化用例(数值退化场景) - 20
} - 21
- 22
///| - 23
pub extend TestCategory with @debug.Debug::{to_repr} - 24
- 25
///| - 26
pub extend TestCategory with Eq::{not_equal, equal} - 27
- 28
///| - 29
/// 退化类型(对应 4.7.4 领域规则)。 - 30
/// 描述 Degradation kind (corresponds to 4.7.4 domain rules). - 31
/// `#non_exhaustive` 表示未来可能添加新构造器 - 32
#derive(Eq, @debug.Debug) - 33
#non_exhaustive - 34
pub(all) enum DegradationKind { - 35
DivisionByZero // 除零 - 36
SingularMatrix // 奇异矩阵(行列式 ≈ 0) - 37
FieldDiscontinuity // 场间断(边界不连续) - 38
Overflow // 整数/浮点溢出 - 39
NaNValue // NaN 传播 - 40
InfValue // Inf 传播 - 41
} - 42
- 43
///| - 44
pub extend DegradationKind with @debug.Debug::{to_repr} - 45
- 46
///| - 47
pub extend DegradationKind with Eq::{not_equal, equal} - 48
- 49
///| - 50
/// 严重程度。 - 51
/// 描述 Severity level. - 52
/// `#non_exhaustive` 表示未来可能添加新构造器 - 53
#derive(Eq, @debug.Debug) - 54
#non_exhaustive - 55
pub(all) enum Severity { - 56
Warning // 警告:结果可能不精确但可用 - 57
Critical // 严重:结果不可靠 - 58
Fatal // 致命:会崩溃或抛异常 - 59
} - 60
- 61
///| - 62
pub extend Severity with @debug.Debug::{to_repr} - 63
- 64
///| - 65
pub extend Severity with Eq::{not_equal, equal} - 66
- 67
///| - 68
/// 自动生成的测试用例描述。 - 69
/// 描述 Auto-generated test case description. - 70
#derive(Eq, @debug.Debug) - 71
pub(all) struct TestCase { - 72
name : String - 73
op_tag : String - 74
category : TestCategory - 75
description : String - 76
input_spec : String - 77
expected_behavior : String - 78
} - 79
- 80
///| - 81
pub extend TestCase with @debug.Debug::{to_repr} - 82
- 83
///| - 84
pub extend TestCase with Eq::{not_equal, equal} - 85
- 86
///| - 87
/// 退化场景描述。 - 88
/// 描述 Degradation case description. - 89
#derive(Eq, @debug.Debug) - 90
pub(all) struct DegradationCase { - 91
kind : DegradationKind - 92
op_tag : String - 93
description : String - 94
severity : Severity - 95
} - 96
- 97
///| - 98
pub extend DegradationCase with @debug.Debug::{to_repr} - 99
- 100
///| - 101
pub extend DegradationCase with Eq::{not_equal, equal} - 102
- 103
///| - 104
/// 演化报告:生成的测试 + 发现的退化。 - 105
/// 描述 Evolution report: generated tests + found degradations. - 106
#derive(Eq, @debug.Debug) - 107
pub(all) struct EvolveReport { - 108
generated_tests : Array[TestCase] - 109
found_degradations : Array[DegradationCase] - 110
summary : String - 111
} - 112
- 113
///| - 114
pub extend EvolveReport with @debug.Debug::{to_repr} - 115
- 116
///| - 117
pub extend EvolveReport with Eq::{not_equal, equal} - 118
- 119
///| - 120
/// 测试用例数量。 - 121
/// 描述 Number of test cases. - 122
pub fn EvolveReport::test_count(self : EvolveReport) -> Int32 { - 123●
self.generated_tests.length() - 124
} - 125
- 126
///| - 127
/// 退化场景数量。 - 128
/// 描述 Number of degradation cases. - 129
pub fn EvolveReport::degradation_count(self : EvolveReport) -> Int32 { - 130●
self.found_degradations.length() - 131
} - 132
- 133
///| - 134
/// 严重退化数量(Critical + Fatal)。 - 135
/// 描述 Number of severe degradations. - 136
pub fn EvolveReport::severe_count(self : EvolveReport) -> Int32 { - 137●
let mut count = 0 - 138
for d in self.found_degradations { - 139○
match d.severity { - 140○
Warning => () - 141○
Critical => count = count + 1 - 142○
Fatal => count = count + 1 - 143
} - 144
} - 145
count - 146
}