Sha256: 90ceb65d6b0e058906d0888d0da99f5cb32f1059e0890c0b65ae86b3af105feb

Contents?: true

Size: 591 Bytes

Versions: 19

Compression:

Stored size: 591 Bytes

Contents

macro_rules! rb_assert {
    ($s:literal) => {
        assert!(magnus::eval::<bool>($s).unwrap())
    };
    ($s:literal, $($rest:tt)*) => {
        let result: bool = magnus::eval!($s, $($rest)*).unwrap();
        assert!(result)
    };
}

#[test]
fn it_converts_floats_to_value() {
    let _cleanup = unsafe { magnus::embed::init() };
    rb_assert!("val == 0.5", val = 0.5);

    rb_assert!(
        "val == 18446744073709552000.0",
        val = 18446744073709552000.0
    );

    rb_assert!("val == Float::INFINITY", val = f64::INFINITY);

    rb_assert!("val.nan?", val = f64::NAN);
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
wasmtime-14.0.4 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-14.0.3 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-14.0.1 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-14.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-13.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-12.0.1 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-12.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-11.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-10.0.1 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-10.0.0 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-9.0.4 ./ext/cargo-vendor/magnus-0.5.5/tests/float_convert_to_value.rs
wasmtime-9.0.1 ./ext/cargo-vendor/magnus-0.5.3/tests/float_convert_to_value.rs
wasmtime-8.0.0 ./ext/cargo-vendor/magnus-0.5.3/tests/float_convert_to_value.rs
wasmtime-7.0.0 ./ext/cargo-vendor/magnus-0.5.2/tests/float_convert_to_value.rs
wasmtime-6.0.1 ./ext/cargo-vendor/magnus-0.5.1/tests/float_convert_to_value.rs
wasmtime-6.0.0 ./ext/cargo-vendor/magnus-0.5.1/tests/float_convert_to_value.rs
wasmtime-5.0.0 ./ext/cargo-vendor/magnus-0.4.4/tests/float_convert_to_value.rs
wasmtime-0.4.1 ./ext/cargo-vendor/magnus-0.4.4/tests/float_convert_to_value.rs
wasmtime-0.4.0 ./ext/cargo-vendor/magnus-0.4.3/tests/float_convert_to_value.rs