Debian Codegraph @

tests/numbers.rs

raw symbols SCIP
1 use ronrust-analyzer cargo ron 0.12.0 crate/::{
2 derust-analyzer cargo ron 0.12.0 de/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().,
3 errorrust-analyzer cargo ron 0.12.0 error/::{Errorrust-analyzer cargo ron 0.12.0 error/Error#, 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#},
4 };
5
6 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
7 fn test_hexrust-analyzer cargo ron 0.12.0 test_hex().() {
8 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("0x507"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0x507));
9 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("0x1A5"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0x1A5));
10 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("0x53C537"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0x53C537));
11
12 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
13 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("0x"),
14 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
15 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedIntegerrust-analyzer cargo ron 0.12.0 error/Error#ExpectedInteger#,
16 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
17 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 },
18 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.: 3 },
19 }
20 })
21 );
22 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
23 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("0x_1"),
24 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
25 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnderscoreAtBeginningrust-analyzer cargo ron 0.12.0 error/Error#UnderscoreAtBeginning#,
26 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
27 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 },
28 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.: 3 },
29 }
30 })
31 );
32 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
33 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("0xFFF"),
34 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
35 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::IntegerOutOfBoundsrust-analyzer cargo ron 0.12.0 error/Error#IntegerOutOfBounds#,
36 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
37 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.: 3 },
38 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.: 6 },
39 }
40 })
41 );
42 }
43
44 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
45 fn test_binrust-analyzer cargo ron 0.12.0 test_bin().() {
46 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("0b101"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0b101));
47 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("0b001"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0b001));
48 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("0b100100"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0b100100));
49
50 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
51 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("0b"),
52 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
53 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedIntegerrust-analyzer cargo ron 0.12.0 error/Error#ExpectedInteger#,
54 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
55 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 },
56 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.: 3 },
57 }
58 })
59 );
60 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
61 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("0b_1"),
62 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
63 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnderscoreAtBeginningrust-analyzer cargo ron 0.12.0 error/Error#UnderscoreAtBeginning#,
64 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
65 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 },
66 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.: 3 },
67 }
68 })
69 );
70 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
71 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("0b111111111"),
72 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
73 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::IntegerOutOfBoundsrust-analyzer cargo ron 0.12.0 error/Error#IntegerOutOfBounds#,
74 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
75 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.: 3 },
76 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.: 12 },
77 }
78 })
79 );
80 }
81
82 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
83 fn test_octrust-analyzer cargo ron 0.12.0 test_oct().() {
84 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("0o1461"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0o1461));
85 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("0o051"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0o051));
86 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("0o150700"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0o150700));
87
88 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
89 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("0o"),
90 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
91 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedIntegerrust-analyzer cargo ron 0.12.0 error/Error#ExpectedInteger#,
92 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
93 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 },
94 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.: 3 },
95 }
96 })
97 );
98 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
99 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("0o_1"),
100 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
101 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnderscoreAtBeginningrust-analyzer cargo ron 0.12.0 error/Error#UnderscoreAtBeginning#,
102 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
103 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 },
104 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.: 3 },
105 }
106 })
107 );
108 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
109 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("0o77777"),
110 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
111 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::IntegerOutOfBoundsrust-analyzer cargo ron 0.12.0 error/Error#IntegerOutOfBounds#,
112 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
113 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.: 3 },
114 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.: 8 },
115 }
116 })
117 );
118 }
119
120 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
121 fn test_decrust-analyzer cargo ron 0.12.0 test_dec().() {
122 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("1461"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1461));
123 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("51"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(51));
124 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(from_strrust-analyzer cargo ron 0.12.0 de/from_str().("150700"), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(150700));
125
126 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
127 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<i8>("-_1"),
128 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
129 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnderscoreAtBeginningrust-analyzer cargo ron 0.12.0 error/Error#UnderscoreAtBeginning#,
130 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
131 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 },
132 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.: 2 },
133 }
134 })
135 );
136 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
137 from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("256"),
138 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
139 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::IntegerOutOfBoundsrust-analyzer cargo ron 0.12.0 error/Error#IntegerOutOfBounds#,
140 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
141 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 },
142 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.: 4 },
143 }
144 })
145 );
146 }