mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-24 02:23:11 +03:00
93a510ef93
This information is embedded within the algorithm for constructing interfaces and their prototypes in the section for ECMAScript glue in the WebIDL spec... This really *should* make the `wasm_bindgen_backend::ast::ImportType::extends` member from a `Vec<Ident>` into a `Vec<syn::Path>` so that we could use `js_sys::Object` in the extends field, but that is a huge pain because then the `ImportedTypes` trait needs to be changed, and all of its implementers, etc...
49 lines
1.5 KiB
Rust
49 lines
1.5 KiB
Rust
use js_sys::Object;
|
|
use wasm_bindgen_test::*;
|
|
|
|
include!(concat!(env!("OUT_DIR"), "/consts.rs"));
|
|
|
|
#[wasm_bindgen_test]
|
|
fn bool() {
|
|
let falsish: bool = ConstBool::NOT_TRUE;
|
|
assert!(!falsish);
|
|
let trueish: bool = ConstBool::NOT_FALSE;
|
|
assert!(trueish);
|
|
}
|
|
|
|
#[wasm_bindgen_test]
|
|
fn ints() {
|
|
assert_eq!(ConstByte::IMIN, i8::min_value());
|
|
assert_eq!(ConstByte::IMAX, i8::max_value());
|
|
assert_eq!(ConstByte::UMIN, u8::min_value());
|
|
assert_eq!(ConstByte::UMAX, u8::max_value());
|
|
|
|
assert_eq!(ConstShort::IMIN, i16::min_value());
|
|
assert_eq!(ConstShort::IMAX, i16::max_value());
|
|
assert_eq!(ConstShort::UMIN, u16::min_value());
|
|
assert_eq!(ConstShort::UMAX, u16::max_value());
|
|
|
|
assert_eq!(ConstLong::IMIN, i32::min_value());
|
|
assert_eq!(ConstLong::IMAX, i32::max_value());
|
|
assert_eq!(ConstLong::UMIN, u32::min_value());
|
|
assert_eq!(ConstLong::UMAX, u32::max_value());
|
|
}
|
|
|
|
#[wasm_bindgen_test]
|
|
fn floats() {
|
|
assert_eq!(ConstFloats::F, 0.0_f32);
|
|
assert!(ConstFloats::NEG_INF.is_infinite());
|
|
assert!(ConstFloats::NEG_INF.is_sign_negative());
|
|
assert!(ConstFloats::INF.is_infinite());
|
|
assert!(ConstFloats::INF.is_sign_positive());
|
|
assert!(ConstFloats::NAN.is_nan());
|
|
|
|
assert_eq!(ConstDoubles::D, 0.0_f64);
|
|
assert!(ConstDoubles::NEG_INF.is_infinite());
|
|
assert!(ConstDoubles::NEG_INF.is_sign_negative());
|
|
assert!(ConstDoubles::INF.is_infinite());
|
|
assert!(ConstDoubles::INF.is_sign_positive());
|
|
assert!(ConstDoubles::NAN.is_nan());
|
|
assert_eq!(ConstDoubles::ONE, 1.0);
|
|
}
|