diff --git a/tests/all/main.rs b/tests/all/main.rs index 69c894435..ea2f150bd 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -18,7 +18,6 @@ mod math; mod node; mod non_debug; mod non_wasm; -mod optional_numbers; mod simple; mod slice; mod structural; diff --git a/tests/all/optional_numbers.rs b/tests/all/optional_numbers.rs deleted file mode 100644 index 360eae050..000000000 --- a/tests/all/optional_numbers.rs +++ /dev/null @@ -1,331 +0,0 @@ -use super::project; - -#[test] -fn works() { - project() - .requires_bigint() - .file( - "src/lib.rs", - r#" - #![feature(use_extern_macros)] - - extern crate wasm_bindgen; - - use wasm_bindgen::prelude::*; - - #[wasm_bindgen(module = "./test")] - extern { - fn i32_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn i32_none() -> Option { None } - #[wasm_bindgen] - pub fn i32_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn i32_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn i32_neg_one() -> Option { Some(-1) } - #[wasm_bindgen] - pub fn i32_max() -> Option { Some(i32::max_value()) } - #[wasm_bindgen] - pub fn i32_min() -> Option { Some(i32::min_value()) } - #[wasm_bindgen] - pub fn i32_identity(a: Option) -> Option { i32_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn u32_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn u32_none() -> Option { None } - #[wasm_bindgen] - pub fn u32_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn u32_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn u32_max() -> Option { Some(u32::max_value()) } - #[wasm_bindgen] - pub fn u32_min() -> Option { Some(u32::min_value()) } - #[wasm_bindgen] - pub fn u32_identity(a: Option) -> Option { u32_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn isize_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn isize_none() -> Option { None } - #[wasm_bindgen] - pub fn isize_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn isize_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn isize_neg_one() -> Option { Some(-1) } - #[wasm_bindgen] - pub fn isize_max() -> Option { Some(isize::max_value()) } - #[wasm_bindgen] - pub fn isize_min() -> Option { Some(isize::min_value()) } - #[wasm_bindgen] - pub fn isize_identity(a: Option) -> Option { isize_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn usize_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn usize_none() -> Option { None } - #[wasm_bindgen] - pub fn usize_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn usize_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn usize_max() -> Option { Some(usize::max_value()) } - #[wasm_bindgen] - pub fn usize_min() -> Option { Some(usize::min_value()) } - #[wasm_bindgen] - pub fn usize_identity(a: Option) -> Option { usize_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn f32_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn f32_none() -> Option { None } - #[wasm_bindgen] - pub fn f32_zero() -> Option { Some(0f32) } - #[wasm_bindgen] - pub fn f32_one() -> Option { Some(1f32) } - #[wasm_bindgen] - pub fn f32_neg_one() -> Option { Some(-1f32) } - #[wasm_bindgen] - pub fn f32_identity(a: Option) -> Option { f32_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn f64_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn f64_none() -> Option { None } - #[wasm_bindgen] - pub fn f64_zero() -> Option { Some(0f64) } - #[wasm_bindgen] - pub fn f64_one() -> Option { Some(1f64) } - #[wasm_bindgen] - pub fn f64_neg_one() -> Option { Some(-1f64) } - #[wasm_bindgen] - pub fn f64_identity(a: Option) -> Option { f64_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn i8_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn i8_none() -> Option { None } - #[wasm_bindgen] - pub fn i8_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn i8_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn i8_neg_one() -> Option { Some(-1) } - #[wasm_bindgen] - pub fn i8_max() -> Option { Some(i8::max_value()) } - #[wasm_bindgen] - pub fn i8_min() -> Option { Some(i8::min_value()) } - #[wasm_bindgen] - pub fn i8_identity(a: Option) -> Option { i8_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn u8_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn u8_none() -> Option { None } - #[wasm_bindgen] - pub fn u8_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn u8_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn u8_max() -> Option { Some(u8::max_value()) } - #[wasm_bindgen] - pub fn u8_min() -> Option { Some(u8::min_value()) } - #[wasm_bindgen] - pub fn u8_identity(a: Option) -> Option { u8_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn i16_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn i16_none() -> Option { None } - #[wasm_bindgen] - pub fn i16_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn i16_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn i16_neg_one() -> Option { Some(-1) } - #[wasm_bindgen] - pub fn i16_max() -> Option { Some(i16::max_value()) } - #[wasm_bindgen] - pub fn i16_min() -> Option { Some(i16::min_value()) } - #[wasm_bindgen] - pub fn i16_identity(a: Option) -> Option { i16_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn u16_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn u16_none() -> Option { None } - #[wasm_bindgen] - pub fn u16_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn u16_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn u16_max() -> Option { Some(u16::max_value()) } - #[wasm_bindgen] - pub fn u16_min() -> Option { Some(u16::min_value()) } - #[wasm_bindgen] - pub fn u16_identity(a: Option) -> Option { u16_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn i64_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn i64_none() -> Option { None } - #[wasm_bindgen] - pub fn i64_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn i64_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn i64_neg_one() -> Option { Some(-1) } - #[wasm_bindgen] - pub fn i64_max() -> Option { Some(i64::max_value()) } - #[wasm_bindgen] - pub fn i64_min() -> Option { Some(i64::min_value()) } - #[wasm_bindgen] - pub fn i64_identity(a: Option) -> Option { i64_js_identity(a) } - - #[wasm_bindgen(module = "./test")] - extern { - fn u64_js_identity(a: Option) -> Option; - } - #[wasm_bindgen] - pub fn u64_none() -> Option { None } - #[wasm_bindgen] - pub fn u64_zero() -> Option { Some(0) } - #[wasm_bindgen] - pub fn u64_one() -> Option { Some(1) } - #[wasm_bindgen] - pub fn u64_max() -> Option { Some(u64::max_value()) } - #[wasm_bindgen] - pub fn u64_min() -> Option { Some(u64::min_value()) } - #[wasm_bindgen] - pub fn u64_identity(a: Option) -> Option { u64_js_identity(a) } - "#, - ) - .file( - "test.js", - r#" - import * as wasm from './out'; - - function assertEq(a, b) { - console.log(a, '?=', b); - if (a === b) - return; - throw new Error('not equal'); - } - - export function test() { - assertEq(wasm.i32_identity(wasm.i32_none()), undefined); - assertEq(wasm.i32_identity(wasm.i32_zero()), 0); - assertEq(wasm.i32_identity(wasm.i32_one()), 1); - assertEq(wasm.i32_identity(wasm.i32_neg_one()), -1); - assertEq(wasm.i32_identity(wasm.i32_max()), 2147483647); - assertEq(wasm.i32_identity(wasm.i32_min()), -2147483648); - - assertEq(wasm.u32_identity(wasm.u32_none()), undefined); - assertEq(wasm.u32_identity(wasm.u32_zero()), 0); - assertEq(wasm.u32_identity(wasm.u32_one()), 1); - assertEq(wasm.u32_identity(wasm.u32_max()), 4294967295); - assertEq(wasm.u32_identity(wasm.u32_min()), 0); - - assertEq(wasm.isize_identity(wasm.isize_none()), undefined); - assertEq(wasm.isize_identity(wasm.isize_zero()), 0); - assertEq(wasm.isize_identity(wasm.isize_one()), 1); - assertEq(wasm.isize_identity(wasm.isize_neg_one()), -1); - assertEq(wasm.isize_identity(wasm.isize_max()), 2147483647); - assertEq(wasm.isize_identity(wasm.isize_min()), -2147483648); - - assertEq(wasm.usize_identity(wasm.usize_none()), undefined); - assertEq(wasm.usize_identity(wasm.usize_zero()), 0); - assertEq(wasm.usize_identity(wasm.usize_one()), 1); - assertEq(wasm.usize_identity(wasm.usize_max()), 4294967295); - assertEq(wasm.usize_identity(wasm.usize_min()), 0); - - assertEq(wasm.f32_identity(wasm.f32_none()), undefined); - assertEq(wasm.f32_identity(wasm.f32_zero()), 0); - assertEq(wasm.f32_identity(wasm.f32_one()), 1); - assertEq(wasm.f32_identity(wasm.f32_neg_one()), -1); - - assertEq(wasm.f64_identity(wasm.f64_none()), undefined); - assertEq(wasm.f64_identity(wasm.f64_zero()), 0); - assertEq(wasm.f64_identity(wasm.f64_one()), 1); - assertEq(wasm.f64_identity(wasm.f64_neg_one()), -1); - - assertEq(wasm.i8_identity(wasm.i8_none()), undefined); - assertEq(wasm.i8_identity(wasm.i8_zero()), 0); - assertEq(wasm.i8_identity(wasm.i8_one()), 1); - assertEq(wasm.i8_identity(wasm.i8_neg_one()), -1); - assertEq(wasm.i8_identity(wasm.i8_max()), 127); - assertEq(wasm.i8_identity(wasm.i8_min()), -128); - - assertEq(wasm.u8_identity(wasm.u8_none()), undefined); - assertEq(wasm.u8_identity(wasm.u8_zero()), 0); - assertEq(wasm.u8_identity(wasm.u8_one()), 1); - assertEq(wasm.u8_identity(wasm.u8_max()), 255); - assertEq(wasm.u8_identity(wasm.u8_min()), 0); - - assertEq(wasm.i16_identity(wasm.i16_none()), undefined); - assertEq(wasm.i16_identity(wasm.i16_zero()), 0); - assertEq(wasm.i16_identity(wasm.i16_one()), 1); - assertEq(wasm.i16_identity(wasm.i16_neg_one()), -1); - assertEq(wasm.i16_identity(wasm.i16_max()), 32767); - assertEq(wasm.i16_identity(wasm.i16_min()), -32768); - - assertEq(wasm.u16_identity(wasm.u16_none()), undefined); - assertEq(wasm.u16_identity(wasm.u16_zero()), 0); - assertEq(wasm.u16_identity(wasm.u16_one()), 1); - assertEq(wasm.u16_identity(wasm.u16_max()), 65535); - assertEq(wasm.u16_identity(wasm.u16_min()), 0); - - assertEq(wasm.i64_identity(wasm.i64_none()), undefined); - assertEq(wasm.i64_identity(wasm.i64_zero()), BigInt("0")); - assertEq(wasm.i64_identity(wasm.i64_one()), BigInt("1")); - assertEq(wasm.i64_identity(wasm.i64_neg_one()), BigInt("-1")); - assertEq(wasm.i64_identity(wasm.i64_max()), BigInt("9223372036854775807")); - assertEq(wasm.i64_identity(wasm.i64_min()), BigInt("-9223372036854775808")); - - assertEq(wasm.u64_identity(wasm.u64_none()), undefined); - assertEq(wasm.u64_identity(wasm.u64_zero()), BigInt("0")); - assertEq(wasm.u64_identity(wasm.u64_one()), BigInt("1")); - assertEq(wasm.u64_identity(wasm.u64_max()), BigInt("18446744073709551615")); - assertEq(wasm.u64_identity(wasm.u64_min()), BigInt("0")); - } - - export function i32_js_identity(a) { return a; } - export function u32_js_identity(a) { return a; } - export function isize_js_identity(a) { return a; } - export function usize_js_identity(a) { return a; } - export function f32_js_identity(a) { return a; } - export function f64_js_identity(a) { return a; } - export function i8_js_identity(a) { return a; } - export function u8_js_identity(a) { return a; } - export function i16_js_identity(a) { return a; } - export function u16_js_identity(a) { return a; } - export function i64_js_identity(a) { return a; } - export function u64_js_identity(a) { return a; } - "#, - ) - .test(); -} diff --git a/tests/wasm/main.rs b/tests/wasm/main.rs index ea4252af2..453983037 100644 --- a/tests/wasm/main.rs +++ b/tests/wasm/main.rs @@ -6,3 +6,4 @@ extern crate wasm_bindgen; pub mod api; pub mod option; +pub mod optional_numbers; diff --git a/tests/wasm/optional_numbers.js b/tests/wasm/optional_numbers.js new file mode 100644 index 000000000..55e600f5f --- /dev/null +++ b/tests/wasm/optional_numbers.js @@ -0,0 +1,92 @@ +const assert = require('assert'); +const wasm = require('wasm-bindgen-test.js'); + +exports.test_works = function() { + assert.strictEqual(wasm.i32_identity(wasm.i32_none()), undefined); + assert.strictEqual(wasm.i32_identity(wasm.i32_zero()), 0); + assert.strictEqual(wasm.i32_identity(wasm.i32_one()), 1); + assert.strictEqual(wasm.i32_identity(wasm.i32_neg_one()), -1); + assert.strictEqual(wasm.i32_identity(wasm.i32_max()), 2147483647); + assert.strictEqual(wasm.i32_identity(wasm.i32_min()), -2147483648); + + assert.strictEqual(wasm.u32_identity(wasm.u32_none()), undefined); + assert.strictEqual(wasm.u32_identity(wasm.u32_zero()), 0); + assert.strictEqual(wasm.u32_identity(wasm.u32_one()), 1); + assert.strictEqual(wasm.u32_identity(wasm.u32_max()), 4294967295); + assert.strictEqual(wasm.u32_identity(wasm.u32_min()), 0); + + assert.strictEqual(wasm.isize_identity(wasm.isize_none()), undefined); + assert.strictEqual(wasm.isize_identity(wasm.isize_zero()), 0); + assert.strictEqual(wasm.isize_identity(wasm.isize_one()), 1); + assert.strictEqual(wasm.isize_identity(wasm.isize_neg_one()), -1); + assert.strictEqual(wasm.isize_identity(wasm.isize_max()), 2147483647); + assert.strictEqual(wasm.isize_identity(wasm.isize_min()), -2147483648); + + assert.strictEqual(wasm.usize_identity(wasm.usize_none()), undefined); + assert.strictEqual(wasm.usize_identity(wasm.usize_zero()), 0); + assert.strictEqual(wasm.usize_identity(wasm.usize_one()), 1); + assert.strictEqual(wasm.usize_identity(wasm.usize_max()), 4294967295); + assert.strictEqual(wasm.usize_identity(wasm.usize_min()), 0); + + assert.strictEqual(wasm.f32_identity(wasm.f32_none()), undefined); + assert.strictEqual(wasm.f32_identity(wasm.f32_zero()), 0); + assert.strictEqual(wasm.f32_identity(wasm.f32_one()), 1); + assert.strictEqual(wasm.f32_identity(wasm.f32_neg_one()), -1); + + assert.strictEqual(wasm.f64_identity(wasm.f64_none()), undefined); + assert.strictEqual(wasm.f64_identity(wasm.f64_zero()), 0); + assert.strictEqual(wasm.f64_identity(wasm.f64_one()), 1); + assert.strictEqual(wasm.f64_identity(wasm.f64_neg_one()), -1); + + assert.strictEqual(wasm.i8_identity(wasm.i8_none()), undefined); + assert.strictEqual(wasm.i8_identity(wasm.i8_zero()), 0); + assert.strictEqual(wasm.i8_identity(wasm.i8_one()), 1); + assert.strictEqual(wasm.i8_identity(wasm.i8_neg_one()), -1); + assert.strictEqual(wasm.i8_identity(wasm.i8_max()), 127); + assert.strictEqual(wasm.i8_identity(wasm.i8_min()), -128); + + assert.strictEqual(wasm.u8_identity(wasm.u8_none()), undefined); + assert.strictEqual(wasm.u8_identity(wasm.u8_zero()), 0); + assert.strictEqual(wasm.u8_identity(wasm.u8_one()), 1); + assert.strictEqual(wasm.u8_identity(wasm.u8_max()), 255); + assert.strictEqual(wasm.u8_identity(wasm.u8_min()), 0); + + assert.strictEqual(wasm.i16_identity(wasm.i16_none()), undefined); + assert.strictEqual(wasm.i16_identity(wasm.i16_zero()), 0); + assert.strictEqual(wasm.i16_identity(wasm.i16_one()), 1); + assert.strictEqual(wasm.i16_identity(wasm.i16_neg_one()), -1); + assert.strictEqual(wasm.i16_identity(wasm.i16_max()), 32767); + assert.strictEqual(wasm.i16_identity(wasm.i16_min()), -32768); + + assert.strictEqual(wasm.u16_identity(wasm.u16_none()), undefined); + assert.strictEqual(wasm.u16_identity(wasm.u16_zero()), 0); + assert.strictEqual(wasm.u16_identity(wasm.u16_one()), 1); + assert.strictEqual(wasm.u16_identity(wasm.u16_max()), 65535); + assert.strictEqual(wasm.u16_identity(wasm.u16_min()), 0); + + assert.strictEqual(wasm.i64_identity(wasm.i64_none()), undefined); + assert.strictEqual(wasm.i64_identity(wasm.i64_zero()), BigInt("0")); + assert.strictEqual(wasm.i64_identity(wasm.i64_one()), BigInt("1")); + assert.strictEqual(wasm.i64_identity(wasm.i64_neg_one()), BigInt("-1")); + assert.strictEqual(wasm.i64_identity(wasm.i64_max()), BigInt("9223372036854775807")); + assert.strictEqual(wasm.i64_identity(wasm.i64_min()), BigInt("-9223372036854775808")); + + assert.strictEqual(wasm.u64_identity(wasm.u64_none()), undefined); + assert.strictEqual(wasm.u64_identity(wasm.u64_zero()), BigInt("0")); + assert.strictEqual(wasm.u64_identity(wasm.u64_one()), BigInt("1")); + assert.strictEqual(wasm.u64_identity(wasm.u64_max()), BigInt("18446744073709551615")); + assert.strictEqual(wasm.u64_identity(wasm.u64_min()), BigInt("0")); +}; + +exports.i32_js_identity = function(a) { return a; } +exports.u32_js_identity = function(a) { return a; } +exports.isize_js_identity = function(a) { return a; } +exports.usize_js_identity = function(a) { return a; } +exports.f32_js_identity = function(a) { return a; } +exports.f64_js_identity = function(a) { return a; } +exports.i8_js_identity = function(a) { return a; } +exports.u8_js_identity = function(a) { return a; } +exports.i16_js_identity = function(a) { return a; } +exports.u16_js_identity = function(a) { return a; } +exports.i64_js_identity = function(a) { return a; } +exports.u64_js_identity = function(a) { return a; } diff --git a/tests/wasm/optional_numbers.rs b/tests/wasm/optional_numbers.rs new file mode 100644 index 000000000..34f187cdf --- /dev/null +++ b/tests/wasm/optional_numbers.rs @@ -0,0 +1,187 @@ +use wasm_bindgen_test::*; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen(module = "tests/wasm/optional_numbers.js", version = "*")] +extern { + fn i32_js_identity(a: Option) -> Option; + fn u32_js_identity(a: Option) -> Option; + fn isize_js_identity(a: Option) -> Option; + fn usize_js_identity(a: Option) -> Option; + fn f32_js_identity(a: Option) -> Option; + fn f64_js_identity(a: Option) -> Option; + fn i8_js_identity(a: Option) -> Option; + fn u8_js_identity(a: Option) -> Option; + fn i16_js_identity(a: Option) -> Option; + fn u16_js_identity(a: Option) -> Option; + fn i64_js_identity(a: Option) -> Option; + fn u64_js_identity(a: Option) -> Option; + + fn test_works(); +} + +#[wasm_bindgen] +pub fn i32_none() -> Option { None } +#[wasm_bindgen] +pub fn i32_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn i32_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn i32_neg_one() -> Option { Some(-1) } +#[wasm_bindgen] +pub fn i32_max() -> Option { Some(i32::max_value()) } +#[wasm_bindgen] +pub fn i32_min() -> Option { Some(i32::min_value()) } +#[wasm_bindgen] +pub fn i32_identity(a: Option) -> Option { i32_js_identity(a) } + +#[wasm_bindgen] +pub fn u32_none() -> Option { None } +#[wasm_bindgen] +pub fn u32_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn u32_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn u32_max() -> Option { Some(u32::max_value()) } +#[wasm_bindgen] +pub fn u32_min() -> Option { Some(u32::min_value()) } +#[wasm_bindgen] +pub fn u32_identity(a: Option) -> Option { u32_js_identity(a) } + +#[wasm_bindgen] +pub fn isize_none() -> Option { None } +#[wasm_bindgen] +pub fn isize_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn isize_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn isize_neg_one() -> Option { Some(-1) } +#[wasm_bindgen] +pub fn isize_max() -> Option { Some(isize::max_value()) } +#[wasm_bindgen] +pub fn isize_min() -> Option { Some(isize::min_value()) } +#[wasm_bindgen] +pub fn isize_identity(a: Option) -> Option { isize_js_identity(a) } + +#[wasm_bindgen] +pub fn usize_none() -> Option { None } +#[wasm_bindgen] +pub fn usize_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn usize_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn usize_max() -> Option { Some(usize::max_value()) } +#[wasm_bindgen] +pub fn usize_min() -> Option { Some(usize::min_value()) } +#[wasm_bindgen] +pub fn usize_identity(a: Option) -> Option { usize_js_identity(a) } + +#[wasm_bindgen] +pub fn f32_none() -> Option { None } +#[wasm_bindgen] +pub fn f32_zero() -> Option { Some(0f32) } +#[wasm_bindgen] +pub fn f32_one() -> Option { Some(1f32) } +#[wasm_bindgen] +pub fn f32_neg_one() -> Option { Some(-1f32) } +#[wasm_bindgen] +pub fn f32_identity(a: Option) -> Option { f32_js_identity(a) } + +#[wasm_bindgen] +pub fn f64_none() -> Option { None } +#[wasm_bindgen] +pub fn f64_zero() -> Option { Some(0f64) } +#[wasm_bindgen] +pub fn f64_one() -> Option { Some(1f64) } +#[wasm_bindgen] +pub fn f64_neg_one() -> Option { Some(-1f64) } +#[wasm_bindgen] +pub fn f64_identity(a: Option) -> Option { f64_js_identity(a) } + +#[wasm_bindgen] +pub fn i8_none() -> Option { None } +#[wasm_bindgen] +pub fn i8_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn i8_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn i8_neg_one() -> Option { Some(-1) } +#[wasm_bindgen] +pub fn i8_max() -> Option { Some(i8::max_value()) } +#[wasm_bindgen] +pub fn i8_min() -> Option { Some(i8::min_value()) } +#[wasm_bindgen] +pub fn i8_identity(a: Option) -> Option { i8_js_identity(a) } + +#[wasm_bindgen] +pub fn u8_none() -> Option { None } +#[wasm_bindgen] +pub fn u8_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn u8_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn u8_max() -> Option { Some(u8::max_value()) } +#[wasm_bindgen] +pub fn u8_min() -> Option { Some(u8::min_value()) } +#[wasm_bindgen] +pub fn u8_identity(a: Option) -> Option { u8_js_identity(a) } + +#[wasm_bindgen] +pub fn i16_none() -> Option { None } +#[wasm_bindgen] +pub fn i16_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn i16_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn i16_neg_one() -> Option { Some(-1) } +#[wasm_bindgen] +pub fn i16_max() -> Option { Some(i16::max_value()) } +#[wasm_bindgen] +pub fn i16_min() -> Option { Some(i16::min_value()) } +#[wasm_bindgen] +pub fn i16_identity(a: Option) -> Option { i16_js_identity(a) } + +#[wasm_bindgen] +pub fn u16_none() -> Option { None } +#[wasm_bindgen] +pub fn u16_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn u16_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn u16_max() -> Option { Some(u16::max_value()) } +#[wasm_bindgen] +pub fn u16_min() -> Option { Some(u16::min_value()) } +#[wasm_bindgen] +pub fn u16_identity(a: Option) -> Option { u16_js_identity(a) } + +#[wasm_bindgen] +pub fn i64_none() -> Option { None } +#[wasm_bindgen] +pub fn i64_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn i64_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn i64_neg_one() -> Option { Some(-1) } +#[wasm_bindgen] +pub fn i64_max() -> Option { Some(i64::max_value()) } +#[wasm_bindgen] +pub fn i64_min() -> Option { Some(i64::min_value()) } +#[wasm_bindgen] +pub fn i64_identity(a: Option) -> Option { i64_js_identity(a) } + +#[wasm_bindgen] +pub fn u64_none() -> Option { None } +#[wasm_bindgen] +pub fn u64_zero() -> Option { Some(0) } +#[wasm_bindgen] +pub fn u64_one() -> Option { Some(1) } +#[wasm_bindgen] +pub fn u64_max() -> Option { Some(u64::max_value()) } +#[wasm_bindgen] +pub fn u64_min() -> Option { Some(u64::min_value()) } +#[wasm_bindgen] +pub fn u64_identity(a: Option) -> Option { u64_js_identity(a) } + +#[wasm_bindgen_test] +fn works() { + test_works(); +}