Debian Codegraph @

tests/370_float_parsing.rs

raw symbols SCIP
1 use ronrust-analyzer cargo ron 0.12.0 crate/::{
2 derust-analyzer cargo ron 0.12.0 de/::{Positionrust-analyzer cargo ron 0.12.0 error/Position#, Spanrust-analyzer cargo ron 0.12.0 error/Span#, SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError#},
3 Errorrust-analyzer cargo ron 0.12.0 error/Error#,
4 };
5
6 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
7 fn test_float_literal_parsingrust-analyzer cargo ron 0.12.0 test_float_literal_parsing().() {
8 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("inf"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(f64::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]INFINITY.));
9 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("+inf"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(f64::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]INFINITY.));
10 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("-inf"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(f64::NEG_INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]NEG_INFINITY.));
11
12 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<f64>("NaN").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]is_nan().());
13 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<f64>("+NaN").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]is_nan().());
14 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<f64>("-NaN").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().is_nanrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]is_nan().());
15
16 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1.0_f64));
17 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("+1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1.0_f64));
18 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("-1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().1.0_f64));
19 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("1e3"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1000.0_f64));
20 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("1e+1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(10.0_f64));
21 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("7E-1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0.7_f64));
22
23 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("1."), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1.0_f64));
24 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("+1.1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1.1_f64));
25 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("-1.42"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().1.42_f64));
26 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("-1.5e3"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().1500.0_f64));
27 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("1.e+1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(10.0_f64));
28 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("7.4E-1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0.74_f64));
29
30 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().(".1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0.1_f64));
31 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("+.1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0.1_f64));
32 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("-.42"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().0.42_f64));
33 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("-.5e3"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().500.0_f64));
34 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().(".3e+1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(3.0_f64));
35 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().(".4E-1"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0.04_f64));
36
37 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("1_0.1_0"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(10.1_f32),);
38 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("1_0.10"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(10.1_f32),);
39 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().("10.1_0"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(10.1_f32),);
40
41 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
42 ronrust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<f64>("1.0e1.0"),
43 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
44 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedFloatrust-analyzer cargo ron 0.12.0 error/Error#ExpectedFloat#,
45 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
46 startrust-analyzer cargo ron 0.12.0 error/Span#start.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 1 },
47 endrust-analyzer cargo ron 0.12.0 error/Span#end.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 1 },
48 }
49 })
50 );
51 }