mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-14 14:45:40 +00:00
Merge #884
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 <nick@wasmer.io>
This commit is contained in:
commit
62b2cdc5e9
@ -445,8 +445,9 @@ mod tests {
|
|||||||
"AssertReturnCanonicalNan"
|
"AssertReturnCanonicalNan"
|
||||||
),
|
),
|
||||||
message: format!(
|
message: format!(
|
||||||
"value is not canonical nan {:?}",
|
"value is not canonical nan {:?} ({:?})",
|
||||||
v
|
v,
|
||||||
|
value_to_hex(v.clone()),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
&test_key,
|
&test_key,
|
||||||
@ -512,8 +513,9 @@ mod tests {
|
|||||||
"AssertReturnArithmeticNan"
|
"AssertReturnArithmeticNan"
|
||||||
),
|
),
|
||||||
message: format!(
|
message: format!(
|
||||||
"value is not arithmetic nan {:?}",
|
"value is not arithmetic nan {:?} ({:?})",
|
||||||
v
|
v,
|
||||||
|
value_to_hex(v.clone()),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
&test_key,
|
&test_key,
|
||||||
@ -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)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub enum SpectestValue {
|
pub enum SpectestValue {
|
||||||
I32(i32),
|
I32(i32),
|
||||||
|
Loading…
Reference in New Issue
Block a user