Skip to content

Commit bcef577

Browse files
committed
add test of black digits
1 parent 303f14f commit bcef577

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/tst_mnist.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ end
4141
@test size(A) == (28,28,2)
4242
@test eltype(A) == Gray{N0f8}
4343
@test MNIST.convert2image(vec(data)) == A
44+
45+
# test black digits and white background
46+
data = rand(N0f8,28,28,2)
47+
data[1] = 0
48+
data[3, 3, 2] = 0.4
49+
A = MNIST.convert2image(data; black_digits=true)
50+
@test A[1] == 1
51+
@test A[3, 3, 2] == 0.6
52+
@test size(A) == (28,28,2)a
53+
@test eltype(A) == Gray{N0f8}
54+
@test MNIST.convert2image(vec(data); black_digits=true) == A
4455
end
4556

4657
# NOT executed on CI. only executed locally.

0 commit comments

Comments
 (0)