Merge pull request #19 from paritytech/non-determinism-check

take module as ref in is_deterministic
This commit is contained in:
Alexey
2017-09-22 19:34:29 +03:00
committed by GitHub
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ fn main() {
// Loading module
let module = parity_wasm::deserialize_file(&args[1]).expect("Module deserialization to succeed");
if wasm_utils::is_deterministic(module) {
if wasm_utils::is_deterministic(&module) {
println!("Module is deterministic");
} else {
println!("Module is not deterministic");
+3 -3
View File
@@ -77,7 +77,7 @@ fn have_nondeterministic_opcodes (opcodes: &[Opcode]) -> bool {
pub fn is_deterministic(module: elements::Module) -> bool {
pub fn is_deterministic(module: &elements::Module) -> bool {
for section in module.sections() {
match *section {
Section::Code(ref cs) => {
@@ -114,7 +114,7 @@ mod tests {
.build()
.build()
.build();
assert_eq!(false, is_deterministic(module));
assert_eq!(false, is_deterministic(&module));
}
#[test]
@@ -133,6 +133,6 @@ mod tests {
.build()
.build()
.build();
assert_eq!(true, is_deterministic(module));
assert_eq!(true, is_deterministic(&module));
}
}