parity-wasm/spec/src/test.rs

40 lines
813 B
Rust
Raw Normal View History

2017-06-03 17:45:03 +03:00
#![cfg(test)]
#[derive(Deserialize)]
pub struct RuntimeValue {
#[serde(rename = "type")]
value_type: String,
value: String,
}
#[derive(Deserialize)]
#[serde(tag = "type")]
pub enum Action {
#[serde(rename = "invoke")]
Invoke { field: String, args: Vec<RuntimeValue> }
}
#[derive(Deserialize)]
#[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>,
},
#[serde(rename = "assert_trap")]
AssertTrap {
line: u64,
action: Action,
text: String,
},
}
#[derive(Deserialize)]
pub struct Commands {
source_filename: String,
commands: Vec<Command>,
}