2017-06-03 17:45:03 +03:00
|
|
|
#![cfg(test)]
|
|
|
|
|
2017-06-05 15:30:03 +03:00
|
|
|
#[derive(Deserialize, Debug)]
|
2017-06-03 17:45:03 +03:00
|
|
|
pub struct RuntimeValue {
|
|
|
|
#[serde(rename = "type")]
|
2017-06-03 21:20:52 +03:00
|
|
|
pub value_type: String,
|
|
|
|
pub value: String,
|
2017-06-03 17:45:03 +03:00
|
|
|
}
|
|
|
|
|
2017-06-05 15:30:03 +03:00
|
|
|
#[derive(Deserialize, Debug)]
|
2017-06-03 17:45:03 +03:00
|
|
|
#[serde(tag = "type")]
|
|
|
|
pub enum Action {
|
|
|
|
#[serde(rename = "invoke")]
|
2017-06-13 12:01:59 +03:00
|
|
|
Invoke {
|
|
|
|
module: Option<String>,
|
|
|
|
field: String,
|
|
|
|
args: Vec<RuntimeValue>,
|
|
|
|
},
|
|
|
|
#[serde(rename = "get")]
|
|
|
|
Get {
|
|
|
|
module: Option<String>,
|
|
|
|
field: String,
|
|
|
|
}
|
2017-06-03 17:45:03 +03:00
|
|
|
}
|
|
|
|
|
2017-06-05 15:30:03 +03:00
|
|
|
#[derive(Deserialize, Debug)]
|
2017-06-03 17:45:03 +03:00
|
|
|
#[serde(tag = "type")]
|
|
|
|
pub enum Command {
|
|
|
|
#[serde(rename = "module")]
|
2017-06-13 12:01:59 +03:00
|
|
|
Module {
|
|
|
|
line: u64,
|
|
|
|
name: Option<String>,
|
|
|
|
filename: String
|
|
|
|
},
|
2017-06-03 17:45:03 +03:00
|
|
|
#[serde(rename = "assert_return")]
|
|
|
|
AssertReturn {
|
|
|
|
line: u64,
|
|
|
|
action: Action,
|
|
|
|
expected: Vec<RuntimeValue>,
|
|
|
|
},
|
2017-06-05 18:48:08 +03:00
|
|
|
#[serde(rename = "assert_return_canonical_nan")]
|
|
|
|
AssertReturnCanonicalNan {
|
|
|
|
line: u64,
|
|
|
|
action: Action,
|
|
|
|
},
|
|
|
|
#[serde(rename = "assert_return_arithmetic_nan")]
|
|
|
|
AssertReturnArithmeticNan {
|
|
|
|
line: u64,
|
|
|
|
action: Action,
|
|
|
|
},
|
2017-06-03 17:45:03 +03:00
|
|
|
#[serde(rename = "assert_trap")]
|
|
|
|
AssertTrap {
|
|
|
|
line: u64,
|
|
|
|
action: Action,
|
|
|
|
text: String,
|
|
|
|
},
|
2017-06-05 18:13:17 +03:00
|
|
|
#[serde(rename = "assert_invalid")]
|
|
|
|
AssertInvalid {
|
|
|
|
line: u64,
|
|
|
|
filename: String,
|
|
|
|
text: String,
|
2017-06-05 19:23:49 +03:00
|
|
|
},
|
2017-06-06 14:19:36 +03:00
|
|
|
#[serde(rename = "assert_malformed")]
|
|
|
|
AssertMalformed {
|
|
|
|
line: u64,
|
|
|
|
filename: String,
|
|
|
|
text: String,
|
|
|
|
},
|
2017-06-09 12:13:35 +03:00
|
|
|
#[serde(rename = "assert_uninstantiable")]
|
|
|
|
AssertUninstantiable {
|
|
|
|
line: u64,
|
|
|
|
filename: String,
|
|
|
|
text: String,
|
|
|
|
},
|
|
|
|
#[serde(rename = "assert_exhaustion")]
|
|
|
|
AssertExhaustion {
|
|
|
|
line: u64,
|
|
|
|
action: Action,
|
|
|
|
},
|
|
|
|
#[serde(rename = "assert_unlinkable")]
|
|
|
|
AssertUnlinkable {
|
|
|
|
line: u64,
|
|
|
|
filename: String,
|
|
|
|
text: String,
|
|
|
|
},
|
2017-06-13 12:01:59 +03:00
|
|
|
#[serde(rename = "register")]
|
|
|
|
Register {
|
|
|
|
line: u64,
|
|
|
|
name: Option<String>,
|
|
|
|
#[serde(rename = "as")]
|
|
|
|
as_name: String,
|
|
|
|
},
|
2017-06-05 19:23:49 +03:00
|
|
|
#[serde(rename = "action")]
|
|
|
|
Action {
|
|
|
|
line: u64,
|
|
|
|
action: Action,
|
2017-06-09 12:13:35 +03:00
|
|
|
},
|
2017-06-03 17:45:03 +03:00
|
|
|
}
|
|
|
|
|
2017-06-05 15:30:03 +03:00
|
|
|
#[derive(Deserialize, Debug)]
|
2017-06-03 21:20:52 +03:00
|
|
|
pub struct Spec {
|
|
|
|
pub source_filename: String,
|
|
|
|
pub commands: Vec<Command>,
|
2017-06-03 17:45:03 +03:00
|
|
|
}
|