NAC_Blockchain/test_violations.rs

27 lines
713 B
Rust
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//! 测试文件:包含宪法约束违规的代码
// 违规1硬编码宪法参数
fn test_hardcoded_param() {
let dt_min = 100; // ❌ 应该使用 constitutional_state::CBPP_DT_MIN
println!("dt_min: {}", dt_min);
}
// 违规2硬编码时间常量
fn test_hardcoded_time() {
let max_wait = 2592000; // ❌ 应该使用 constitutional_state::MAX_WAIT_TIME
println!("max_wait: {}", max_wait);
}
// 正确:使用宪法常量
fn test_correct_usage() {
// 假设有constitutional_state模块
// let dt_min = constitutional_state::CBPP_DT_MIN;
// println!("dt_min: {}", dt_min);
}
fn main() {
test_hardcoded_param();
test_hardcoded_time();
test_correct_usage();
}