Debian Codegraph @

tests/f16_tests.rs

raw symbols SCIP
1 #![cfg(feature = "f16")]
2
3 use lexical_utilrust-analyzer cargo lexical-util 1.0.7 crate/::f16rust-analyzer cargo lexical-util 1.0.7 f16/::f16rust-analyzer cargo float16 0.1.3 binary16/f16#;
4 use lexical_utilrust-analyzer cargo lexical-util 1.0.7 crate/::numrust-analyzer cargo lexical-util 1.0.7 num/::Floatrust-analyzer cargo lexical-util 1.0.7 num/Float#;
5
6 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
7 fn as_f32_testrust-analyzer cargo lexical-util 1.0.7 as_f32_test().() {
8 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_bits().(1).as_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]as_f32_const().(), 0.000000059604645);
9 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ZEROrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ZERO..as_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]as_f32_const().(), 0.0f32);
10 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ZEROrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ZERO..to_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]to_bits().(), 0);
11 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE..as_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]as_f32_const().(), 1.0f32);
12 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE..to_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]to_bits().(), (15 << 10));
13 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::TWOrust-analyzer cargo lexical-util 1.0.7 num/impl#[f16][Float]TWO..as_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]as_f32_const().(), 2.0f32);
14 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::TWOrust-analyzer cargo lexical-util 1.0.7 num/impl#[f16][Float]TWO..to_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]to_bits().(), (16 << 10));
15 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_bits().(14 << 10).as_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]as_f32_const().(), 0.5f32);
16 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::NANrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]NAN..as_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]as_f32_const().().is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]is_nan().());
17 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::INFINITYrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]INFINITY..as_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]as_f32_const().().is_infrust-analyzer cargo lexical-util 1.0.7 num/Float#is_inf().());
18 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::NEG_INFINITYrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]NEG_INFINITY..as_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]as_f32_const().().is_infrust-analyzer cargo lexical-util 1.0.7 num/Float#is_inf().());
19 }
20
21 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
22 fn from_f32_testrust-analyzer cargo lexical-util 1.0.7 from_f32_test().() {
23 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_f32_const().(2.980232e-08).to_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]to_bits().(), 0);
24 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_f32_const().(2.9802322e-08).to_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]to_bits().(), 0);
25 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_f32_const().(2.9802326e-08).to_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]to_bits().(), 1);
26 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_f32_const().(5.960464e-08).to_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]to_bits().(), 1);
27 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_f32_const().(5.9604645e-08).to_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]to_bits().(), 1);
28 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_f32_const().(5.960465e-08).to_bitsrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]to_bits().(), 1);
29 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_f32_const().(f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN.).is_nanrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]is_nan().());
30 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_f32_const().(f32::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]INFINITY.).is_infrust-analyzer cargo lexical-util 1.0.7 num/Float#is_inf().());
31 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::from_f32_construst-analyzer cargo float16 0.1.3 binary16/impl#[f16]from_f32_const().(f32::NEG_INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NEG_INFINITY.).is_infrust-analyzer cargo lexical-util 1.0.7 num/Float#is_inf().());
32 }
33
34 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
35 fn math_testsrust-analyzer cargo lexical-util 1.0.7 math_tests().() {
36 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE. +rust-analyzer cargo float16 0.1.3 binary16/impl#[f16][`Add<Self>`]add(). f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE., f16rust-analyzer cargo float16 0.1.3 binary16/f16#::TWOrust-analyzer cargo lexical-util 1.0.7 num/impl#[f16][Float]TWO.);
37 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE. *rust-analyzer cargo float16 0.1.3 binary16/impl#[f16][`Mul<Self>`]mul(). f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE., f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE.);
38 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE. /rust-analyzer cargo float16 0.1.3 binary16/impl#[f16][`Div<Self>`]div(). f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE., f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE.);
39 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE. -rust-analyzer cargo float16 0.1.3 binary16/impl#[f16][`Sub<Self>`]sub(). f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE., f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ZEROrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ZERO.);
40 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE. %rust-analyzer cargo float16 0.1.3 binary16/impl#[f16][`Rem<Self>`]rem(). f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ONErust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ONE., f16rust-analyzer cargo float16 0.1.3 binary16/f16#::ZEROrust-analyzer cargo float16 0.1.3 binary16/impl#[f16]ZERO.);
41 }