parity-wasm/spec/src/test.rs

84 lines
1.8 KiB
Rust
Raw Normal View History

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")]
Invoke { field: String, args: Vec<RuntimeValue> }
}
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")]
Module { line: u64, filename: String },
#[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-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
}