File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -115,3 +115,33 @@ test "@float.Float::is_nan" {
115
115
inspect! (@float .min_value.is_nan (), content = "false" )
116
116
inspect! (@float .min_positive.is_nan (), content = "false" )
117
117
}
118
+
119
+ test "Float::default()" {
120
+ inspect! (Float ::default (), content = "0" )
121
+ }
122
+
123
+ test "Float::to_be_bytes with various values" {
124
+ let f1 : Float = 0.0
125
+ inspect! (f1 .to_be_bytes (), content = "b\"\\ x00\\ x00\\ x00\\ x00\" " )
126
+ let f2 : Float = - 1.0
127
+ inspect! (f2 .to_be_bytes (), content = "b\"\\ xbf\\ x80\\ x00\\ x00\" " )
128
+ let f3 : Float = @float .infinity
129
+ inspect! (f3 .to_be_bytes (), content = "b\"\\ x7f\\ x80\\ x00\\ x00\" " )
130
+ let f4 : Float = @float .not_a_number
131
+ inspect! (f4 .to_be_bytes (), content = "b\"\\ x7f\\ xc0\\ x00\\ x00\" " )
132
+ }
133
+
134
+ test "to_le_bytes for zero" {
135
+ inspect! (
136
+ (0.0 : Float ).to_le_bytes (),
137
+ content =
138
+ #| b"\x00\x00\x00\x00"
139
+ ,
140
+ )
141
+ inspect! (
142
+ (- 0.0 : Float ).to_le_bytes (),
143
+ content =
144
+ #| b"\x00\x00\x00\x80"
145
+ ,
146
+ )
147
+ }
You can’t perform that action at this time.
0 commit comments