mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 19:21:11 +08:00
fix: 修复整型与浮点比较不同问题
This commit is contained in:
@@ -62,7 +62,13 @@ fn test_same_value_nan() {
|
||||
|
||||
#[test]
|
||||
fn test_same_value_type_mismatch() {
|
||||
assert!(!coercion::same_value(JsValue::int(1), JsValue::float(1.0)));
|
||||
assert!(!coercion::same_value(JsValue::int(1), JsValue::bool(true)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_same_value_int_float_equal() {
|
||||
assert!(coercion::same_value(JsValue::int(1), JsValue::float(1.0)));
|
||||
assert!(!coercion::same_value(JsValue::int(1), JsValue::float(2.0)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -76,9 +82,21 @@ fn test_strict_equality_nan() {
|
||||
#[test]
|
||||
fn test_strict_equality_type_mismatch() {
|
||||
assert!(!coercion::strict_equality(
|
||||
JsValue::int(1),
|
||||
JsValue::bool(true)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_strict_equality_int_float_equal() {
|
||||
assert!(coercion::strict_equality(
|
||||
JsValue::int(1),
|
||||
JsValue::float(1.0)
|
||||
));
|
||||
assert!(!coercion::strict_equality(
|
||||
JsValue::int(1),
|
||||
JsValue::float(2.0)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user