Skip to content

Commit

Permalink
Merge #884
Browse files Browse the repository at this point in the history
884: Show the full hex value of a float that fails assert returns arithmetic nan or assert returns canonical nan. r=nlewycky a=nlewycky



Co-authored-by: Nick Lewycky <[email protected]>
  • Loading branch information
bors[bot] and nlewycky authored Oct 17, 2019
2 parents 8c308d0 + c0acd5b commit 62b2cdc
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/spectests/tests/spectest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,9 @@ mod tests {
"AssertReturnCanonicalNan"
),
message: format!(
"value is not canonical nan {:?}",
v
"value is not canonical nan {:?} ({:?})",
v,
value_to_hex(v.clone()),
),
},
&test_key,
Expand Down Expand Up @@ -512,8 +513,9 @@ mod tests {
"AssertReturnArithmeticNan"
),
message: format!(
"value is not arithmetic nan {:?}",
v
"value is not arithmetic nan {:?} ({:?})",
v,
value_to_hex(v.clone()),
),
},
&test_key,
Expand Down Expand Up @@ -945,6 +947,16 @@ mod tests {
}
}

fn value_to_hex(val: wasmer_runtime_core::types::Value) -> String {
match val {
wasmer_runtime_core::types::Value::I32(x) => format!("{:#x}", x),
wasmer_runtime_core::types::Value::I64(x) => format!("{:#x}", x),
wasmer_runtime_core::types::Value::F32(x) => format!("{:#x}", x.to_bits()),
wasmer_runtime_core::types::Value::F64(x) => format!("{:#x}", x.to_bits()),
wasmer_runtime_core::types::Value::V128(x) => format!("{:#x}", x),
}
}

#[derive(Debug, Clone, Eq, PartialEq)]
pub enum SpectestValue {
I32(i32),
Expand Down

0 comments on commit 62b2cdc

Please sign in to comment.