|
224 | 224 | @test StatsBase.midpoints(range(0, stop = 1, length = 5)) == 0.125:0.25:0.875
|
225 | 225 | end
|
226 | 226 |
|
| 227 | +@testset "histogram with -0.0" begin |
| 228 | + @test fit(Histogram, [-0.0, 1.0]) == fit(Histogram, [0.0, 1.0]) |
| 229 | + @test fit(Histogram, [-0.0, 1.0], closed=:right) == |
| 230 | + fit(Histogram, [0.0, 1.0], closed=:right) |
| 231 | + @test fit(Histogram, [-0.0, -1.0]) == fit(Histogram, [0.0, -1.0]) |
| 232 | + @test fit(Histogram, [-0.0, -1.0], closed=:right) == |
| 233 | + fit(Histogram, [0.0, -1.0], closed=:right) |
| 234 | + |
| 235 | + @test fit(Histogram, [-0.0, 1.0], [-0.0, 0.5]) == |
| 236 | + fit(Histogram, [0.0, 1.0], [0.0, 0.5]) == |
| 237 | + fit(Histogram, [-0.0, 1.0], [0.0, 0.5]) == |
| 238 | + fit(Histogram, [0.0, 1.0], [-0.0, 0.5]) == |
| 239 | + fit(Histogram, [0.0, 1.0], 0.0:0.5:0.5) == |
| 240 | + fit(Histogram, [-0.0, 1.0], 0.0:0.5:0.5) |
| 241 | + @test fit(Histogram, [-0.0, 1.0], [-0.5, -0.0]) == |
| 242 | + fit(Histogram, [0.0, 1.0], [-0.5, -0.0]) == |
| 243 | + fit(Histogram, [-0.0, 1.0], [-0.5, 0.0]) == |
| 244 | + fit(Histogram, [0.0, 1.0], [-0.5, 0.0]) == |
| 245 | + fit(Histogram, [-0.0, 1.0], -0.5:0.5:0.0) == |
| 246 | + fit(Histogram, [0.0, 1.0], -0.5:0.5:0.0) |
| 247 | + @test fit(Histogram, [-0.0, 1.0], [-0.5, -0.0], closed=:right) == |
| 248 | + fit(Histogram, [0.0, 1.0], [-0.5, 0.0], closed=:right) == |
| 249 | + fit(Histogram, [0.0, 1.0], -0.5:0.5:0.0, closed=:right) |
| 250 | + @test fit(Histogram, [-0.0, 1.0], [-0.0, 0.5], closed=:right) == |
| 251 | + fit(Histogram, [0.0, 1.0], [0.0, 0.5], closed=:right) == |
| 252 | + fit(Histogram, [0.0, 1.0], [-0.0, 0.5], closed=:right) == |
| 253 | + fit(Histogram, [-0.0, 1.0], [0.0, 0.5], closed=:right) == |
| 254 | + fit(Histogram, [0.0, 1.0], 0.0:0.5:0.5, closed=:right) == |
| 255 | + fit(Histogram, [-0.0, 1.0], 0.0:0.5:0.5, closed=:right) |
| 256 | + @test fit(Histogram, [-0.0, 1.0], [-0.5, -0.0], closed=:right) == |
| 257 | + fit(Histogram, [0.0, 1.0], [-0.5, 0.0], closed=:right) == |
| 258 | + fit(Histogram, [0.0, 1.0], [-0.5, -0.0], closed=:right) == |
| 259 | + fit(Histogram, [-0.0, 1.0], [-0.5, 0.0], closed=:right) == |
| 260 | + fit(Histogram, [0.0, 1.0], -0.5:0.5:0.0, closed=:right) == |
| 261 | + fit(Histogram, [-0.0, 1.0], -0.5:0.5:0.0, closed=:right) |
| 262 | + |
| 263 | + @test_throws ArgumentError fit(Histogram, [-0.5], LinRange(-1.0, -0.0, 3)) |
| 264 | + @test_throws ArgumentError fit(Histogram, [-0.5], UnitRange(-0.0, 1.0)) |
| 265 | +end |
| 266 | + |
227 | 267 | end # @testset "StatsBase.Histogram"
|
0 commit comments