Skip to content

Commit

Permalink
add tests for image formats
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Mar 23, 2024
1 parent 2af3490 commit 4f3b3f0
Show file tree
Hide file tree
Showing 9 changed files with 688 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/maze/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
func TestMain(t *testing.T) {
build, _ := filepath.Abs("../../")
filepath.Walk("../../test", func(path string, info os.FileInfo, err error) error {
if !strings.HasSuffix(path, ".sh") {
return nil
}
t.Run(filepath.Base(path), func(t *testing.T) {
if !strings.HasSuffix(path, ".sh") {
return
}
cmd := exec.Command("bash", filepath.Base(path))
cmd.Dir = filepath.Dir(path)
cmd.Env = append(os.Environ(), "PATH="+build+":"+"/bin")
cmd.Env = append(os.Environ(), "PATH="+build+":/bin:/usr/bin")
var stderr strings.Builder
cmd.Stderr = &stderr
output, err := cmd.Output()
Expand Down
1 change: 1 addition & 0 deletions test/image_png.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
maze --seed 0 --width 10 --height 10 --scale 10 --image png | hexdump
57 changes: 57 additions & 0 deletions test/image_png.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
0000000 5089 474e 0a0d 0a1a 0000 0d00 4849 5244
0000010 0000 d200 0000 d200 0208 0000 b000 09fb
0000020 0015 0300 493b 4144 7854 ec9c 31dd e36e
0000030 143a 5140 c3fb dffb 7e72 8a9b 082a e5ce
0000040 ce73 0769 2589 05cd bd0b fcd0 05ef 9cff
0000050 08ec 8ec8 ec80 c808 808e 08ec 8ec8 ec80
0000060 c808 808e 08ec 7e7c ffd6 b3fe f7fa fbf7
0000070 fcbd 87d1 3ddf c4ce adfb 79ae b9fd 3b56
0000080 b202 2023 023b 23b2 3b20 b202 2023 023b
0000090 23b2 3b20 9f02 bbd5 d7e4 e76b f61d 3dfa
00000a0 daf5 edfa cef9 f79b ab9d 71da 73ee 49ab
00000b0 cec3 5ae7 08ed 8ec8 ec80 c808 808e 08ec
00000c0 8ec8 ec80 c808 808e 08ec 767c f87e ddce
00000d0 6b03 5e77 b9f3 cac9 f79d b56b 2023 023b
00000e0 23b2 3b20 b202 2023 023b 23b2 3b20 b202
00000f0 f023 a530 76a8 ec1e 7898 3bcd de26 d5af
0000100 808e 08ec 8ec8 ec80 c808 808e 08ec 8ec8
0000110 ec80 c808 c08e 94c3 cee2 c4bf b7e7 ff89
0000120 5647 023b 23b2 3b20 b202 2023 023b 23b2
0000130 3b20 b202 2023 023b df5b 54f8 b59d 7130
0000140 c0f7 7739 ff9e 66b1 23b5 3b20 b202 2023
0000150 023b 23b2 3b20 b202 2023 023b 23b2 9d90
0000160 314b 34f1 1de9 dee7 4ff8 b564 2023 023b
0000170 23b2 3b20 b202 2023 023b 23b2 3b20 b202
0000180 7023 5cf0 ea8a 7bcd d3b5 dce2 eefd 384c
0000190 3dce 9d8d 6cdf 23b5 3b20 b202 2023 023b
00001a0 23b2 3b20 b202 2023 023b 23b2 75b0 c52e
00001b0 79c4 5fc0 d3db e770 c8ac 476a 7640 6404
00001c0 4047 0476 4764 7640 6404 4047 0476 4764
00001d0 eb60 9f1b b9ce 0f73 b9c7 c709 fdce 9c4e
00001e0 5915 08ed 8ec8 ec80 c808 808e 08ec 8ec8
00001f0 ec80 c808 808e 08ec 5364 ea8a 7e9d b7b5
0000200 e260 8d2e f373 ab0f 011d 11d9 1d90 d901
0000210 9011 011d 11d9 1d90 d901 9011 811d 5383
0000220 6a8a 5096 2ded 3ea8 2277 1dab d901 9011
0000230 011d 11d9 1d90 d901 9011 011d 11d9 1d90
0000240 ad81 c529 7dc4 e709 a24e b89e a25b b562
0000250 2023 023b 23b2 3b20 b202 2023 023b 23b2
0000260 3b20 b202 f023 a530 b898 e03f 69ce c4c1
0000270 b927 5ce6 860a 1d91 d901 9011 011d 11d9
0000280 1d90 d901 9011 011d 11d9 9878 7852 ffe3
0000290 b9db 31a7 c4f1 1def 3b56 b202 2023 023b
00002a0 23b2 3b20 b202 2023 023b 23b2 3b20 0702
00002b0 52f7 fc4c a4f6 cf3b aee5 959e b3d3 2af9
00002c0 23b2 3b20 b202 2023 023b 23b2 3b20 b202
00002d0 2023 023b f723 4c52 d3dc a950 d59e c27a
00002e0 b561 2023 023b 23b2 3b20 b202 2023 023b
00002f0 23b2 3b20 b202 b023 7a75 b9f6 b5bf f3bf
0000300 8714 dbef 51ff dab1 9011 011d 11d9 1d90
0000310 d901 9011 011d 11d9 1d90 d901 d811 529a
0000320 df7c 83ce 8d3b ce7c 4bcb dab6 9011 011d
0000330 11d9 1d90 d901 9011 011d 11d9 1d90 d901
0000340 7f01 d583 808e 08ec 8ec8 ec80 c808 808e
0000350 08ec 8ec8 ec80 c808 c08e 01ff 0000 ffff
0000360 2e33 bcab 31a1 2280 0000 0000 4549 444e
0000370 42ae 8260
0000374
1 change: 1 addition & 0 deletions test/image_png_answer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
maze --seed 0 --width 10 --height 10 --scale 10 --image png --solution | hexdump
60 changes: 60 additions & 0 deletions test/image_png_answer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
0000000 5089 474e 0a0d 0a1a 0000 0d00 4849 5244
0000010 0000 d200 0000 d200 0208 0000 b000 09fb
0000020 0015 0300 496a 4144 7854 ec9c b1dd db6e
0000030 1430 d140 c8a4 ffff ba72 2976 f809 b981
0000040 7394 5ace 9658 0b94 7e0e f4a5 03e7 9c7e
0000050 08ec 8ec8 ec80 c808 808e 08ec 8ec8 ec80
0000060 c808 808e 08ec 7d7c ff2f f3f9 f763 ffef
0000070 fdf7 febd f2ec abb8 8f03 4e0c e3ea 7373
0000080 835a 1f43 9d54 eaf3 ad7b 0476 4764 7640
0000090 6404 4047 0476 4764 7640 6404 4047 0476
00000a0 8ebe 038d bfb6 afe9 3ebd 591d 767f 5676
00000b0 e713 b7be 3499 be4c 6ad7 4047 0476 4764
00000c0 7640 6404 4047 0476 4764 7640 6404 e047
00000d0 f66b 3bf1 0f77 ddac ce78 7deb 2727 3de7
00000e0 ab0d 011d 11d9 1d90 d901 9011 011d 11d9
00000f0 1d90 d901 9011 811d 94ed daa2 3079 c4f1
0000100 9e73 de78 5af5 08ed 8ec8 ec80 c808 808e
0000110 08ec 8ec8 ec80 c808 808e 08ec a66c 9314
0000120 4b77 33f0 7cee c7ff d59a 808e 08ec 8ec8
0000130 ec80 c808 808e 08ec 8ec8 ec80 c808 c08e
0000140 89e8 e74f f1de f270 4809 a6ef ff7a eec7
0000150 b46f ae3a 8ed5 ec80 c808 808e 08ec 8ec8
0000160 ec80 c808 808e 08ec 8ec8 68c0 314a 5ffb
0000170 cdfc a384 beb2 27de 87ee b098 11da 1d90
0000180 d901 9011 011d 11d9 1d90 d901 9011 011d
0000190 11d9 4cd8 2629 84b3 5a6a ed50 38b4 bd77
00001a0 2bbb 7d7a c43f e4c4 5b3e 08ed 8ec8 ec80
00001b0 c808 808e 08ec 8ec8 ec80 c808 808e 08ec
00001c0 de8c f14b 79c4 b9c0 0d3d aab7 68ae 9f75
00001d0 76ad 6404 4047 0476 4764 7640 6404 4047
00001e0 0476 4764 7640 4604 7c4f e73a 3dce 271c
00001f0 da9f 9934 54f7 7c8f fd7a ad7a 0476 4764
0000200 7640 6404 4047 0476 4764 7640 6404 4047
0000210 0476 29b2 f545 7e9b 5bb5 89e2 34bb edce
0000220 b195 11da 1d90 d901 9011 011d 11d9 1d90
0000230 d901 9011 011d 11d9 3838 a8a5 0966 73d5
0000240 aaa8 7def ab22 011d 11d9 1d90 d901 9011
0000250 011d 11d9 1d90 d901 9011 811d 0fcd 4feb
0000260 01dc 36b0 6a79 efd3 a77b cac5 286e bde3
0000270 5c14 7646 6404 4047 0476 4764 7640 6404
0000280 4047 0476 4764 b360 e297 fb89 ee03 169c
0000290 f13c ee4e 2f78 8f05 3b22 b202 2023 023b
00002a0 23b2 3b20 b202 2023 023b 23b2 99b0 f852
00002b0 ffc5 275f c6ef 23b9 efaf f355 b5f7 11da
00002c0 1d90 d901 9011 011d 11d9 1d90 d901 9011
00002d0 011d 11d9 b838 e297 4f89 ba4f bdf5 d5dc
00002e0 c1a4 b3db 2379 23b2 3b20 b202 2023 023b
00002f0 23b2 3b20 b202 2023 023b dc8f 714b acee
0000300 bcee 99de 5ee6 e7ad 563d 023b 23b2 3b20
0000310 b202 2023 023b 23b2 3b20 b202 2023 023b
0000320 299b dac5 27b9 dd2f 16f9 3b87 7ff7 db9c
0000330 70f1 d58e 808e 08ec 8ec8 ec80 c808 808e
0000340 08ec 8ec8 ec80 c808 c08e 4a68 8ef1 0f3b
0000350 74ee 7de3 0cde 9692 6ca7 23b5 3b20 b202
0000360 2023 023b 23b2 3b20 b202 2023 023b 03b2
0000370 077e 1dab d901 9011 011d 11d9 1d90 d901
0000380 9011 011d 11d9 1d90 bf81 0001 ff00 7bff
0000390 8200 a2ce a1b8 0018 0000 4900 4e45 ae44
00003a0 6042 0082
00003a3
1 change: 1 addition & 0 deletions test/image_svg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
maze --seed 0 --width 10 --height 10 --scale 10 --image svg
Loading

0 comments on commit 4f3b3f0

Please sign in to comment.