interplane.Get Omega
Read in your language

interplane-mv

INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority.

Brought by drakestapleton

branch main Branches Tags History

interplane-mv / rust / crates / interplane-conformance / tests / negative_controls.rs

51 lines · 1332 bytes Raw Blame History
1//! Negative controls (bench/PROTOCOL-0.3.md section 6): only with `--features negative-controls`.
2#![cfg(feature = "negative-controls")]
3use std::path::PathBuf;
4
5use interplane_conformance::negctl::{matrix, Variant};
6
7fn root() -> PathBuf {
8 PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../../conformance")
9}
10
11#[test]
12fn unmodified_runner_passes_everything() {
13 let m = matrix(
14 &root().join("fixtures"),
15 &root().join("negative-controls.json"),
16 )
17 .unwrap();
18 assert_eq!(m["baseline_failed"], serde_json::json!([]));
19}
20
21#[test]
22fn every_variant_turns_a_pass_into_a_detected_failure() {
23 let m = matrix(
24 &root().join("fixtures"),
25 &root().join("negative-controls.json"),
26 )
27 .unwrap();
28 assert_eq!(m["valid"], serde_json::json!(true), "{m}");
29 for v in Variant::ALL {
30 let row = &m["variants"][v.name()];
31 assert_eq!(
32 row["detected"],
33 serde_json::json!(true),
34 "{}: {row}",
35 v.name()
36 );
37 assert!(
38 !row["failed"].as_array().unwrap().is_empty(),
39 "{}",
40 v.name()
41 );
42 }
43}
44
45#[test]
46fn variant_names_round_trip() {
47 for v in Variant::ALL {
48 assert_eq!(Variant::parse(v.name()), Some(v));
49 }
50 assert_eq!(Variant::parse("V9"), None);
51}