File: float_convert_to_value.rs

package info (click to toggle)
rust-magnus 0.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,468 kB
  • sloc: ruby: 150; sh: 17; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 410 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#[test]
fn it_converts_floats_to_value() {
    let ruby = unsafe { magnus::embed::init() };
    magnus::rb_assert!(ruby, "val == 0.5", val = 0.5);

    magnus::rb_assert!(
        ruby,
        "val == 18446744073709552000.0",
        val = 18446744073709552000.0
    );

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

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