zlib: Don't use PASTE for INTMAX error messages
[jimtcl.git] / tests / zlib.test
blobf2b4a365a05e3693c669781fc50c98460cdc6da3
1 # The file tests the jim-zlib.c file; based on tests/zlib.test from Tcl 8.6.
3 # This file contains a collection of tests for one or more of the Tcl built-in
4 # commands. Sourcing this file into Tcl runs the tests and generates output
5 # for errors. No output means no errors were found.
7 # Copyright (c) 1996-1998 by Sun Microsystems, Inc.
8 # Copyright (c) 1998-1999 by Scriptics Corporation.
10 # See the file "license.terms" for information on usage and redistribution of
11 # this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 source [file dirname [info script]]/testing.tcl
14 source [file dirname [info script]]/testing.tcl
16 needs cmd zlib
18 test zlib-1.1 {zlib deflate usage 1} -returnCodes error -body {
19     zlib deflate
20 } -result {wrong # args: should be "zlib deflate string ?level?"}
22 test zlib-1.2 {zlib deflate usage 2} -returnCodes error -body {
23     zlib deflate a b
24 } -result {expected integer but got "b"}
26 test zlib-1.3 {zlib deflate usage 3} -returnCodes error -body {
27     zlib deflate a b c
28 } -result {wrong # args: should be "zlib deflate string ?level?"}
30 test zlib-1.4 {zlib inflate usage 1} -returnCodes error -body {
31     zlib inflate
32 } -result {wrong # args: should be "zlib inflate data ?bufferSize?"}
34 test zlib-1.5 {zlib inflate usage 2} -returnCodes error -body {
35     zlib inflate afdfdfdsfdsfsd
36 } -result {invalid stored block lengths}
38 test zlib-1.6 {zlib inflate usage 3} -returnCodes error -body {
39     zlib inflate afdfdfdsfdsfsd f
40 } -result {expected integer but got "f"}
42 test zlib-1.7 {zlib inflate usage 4} -returnCodes error -body {
43     zlib inflate afdfdfdsfdsfsd 0
44 } -result {buffer size must be 0 to 2147483647}
46 test zlib-2.1 {zlib deflate/inflate} {
47     zlib inflate [zlib deflate abcdefghijklm]
48 } abcdefghijklm
50 test zlib-2.2 {zlib deflate/inflate level and size known} {
51     zlib inflate [zlib deflate abcdefghijklm 9] 13
52 } abcdefghijklm
54 test zlib-2.3 {zlib deflate/inflate bad size} -returnCodes error -body {
55     zlib inflate [zlib deflate abcdefghijklm 9] 0
56 } -result {buffer size must be 0 to 2147483647}
58 test zlib-2.4 {zlib deflate/inflate wrong size} {
59     zlib inflate [zlib deflate abcdefghijklm] 6
60 } abcdefghijklm
62 test zlib-3.1 {zlib gunzip usage 1} -returnCodes error -body {
63     zlib gunzip
64 } -result {wrong # args: should be "zlib gunzip data ?-buffersize size?"}
66 test zlib-3.2 {zlib gunzip usage 2} -returnCodes error -body {
67     zlib gunzip aaa
68 } -result {incorrect header check}
70 test zlib-3.3 {zlib gunzip usage 3} -returnCodes error -body {
71     zlib gunzip aaa 4
72 } -result {wrong # args: should be "zlib gunzip data ?-buffersize size?"}
74 test zlib-3.4 {zlib gunzip usage 4} -returnCodes error -body {
75     zlib gunzip aaa -buffersize
76 } -result {wrong # args: should be "zlib gunzip data ?-buffersize size?"}
78 test zlib-3.5 {zlib gunzip usage 5} -returnCodes error -body {
79     zlib gunzip aaa -buffersize a
80 } -result {wrong # args: should be "zlib gunzip data ?-buffersize size?"}
82 test zlib-3.6 {zlib gunzip usage 5} -returnCodes error -body {
83     zlib gunzip aaa -buffersize a
84 } -result {wrong # args: should be "zlib gunzip data ?-buffersize size?"}
86 test zlib-3.7 {zlib gunzip usage 6} -returnCodes error -body {
87     zlib gunzip aaa -buffersize 0
88 } -result {buffer size must be 0 to 2147483647}
90 test zlib-3.8 {zlib gzip usage 1} -returnCodes error -body {
91     zlib gzip
92 } -result {wrong # args: should be "zlib gzip data ?-level level?"}
94 test zlib-3.9 {zlib gzip usage 2} -returnCodes error -body {
95     zlib gzip aa 9
96 } -result {wrong # args: should be "zlib gzip data ?-level level?"}
98 test zlib-3.10 {zlib gzip usage 3} -returnCodes error -body {
99     zlib gzip -level a
100 } -result {wrong # args: should be "zlib gzip data ?-level level?"}
102 test zlib-3.11 {zlib gzip usage 4} -returnCodes error -body {
103     zlib gzip -level 9 a
104 } -result {wrong # args: should be "zlib gzip data ?-level level?"}
106 test zlib-4.1 {zlib gzip/gunzip} {
107     zlib gunzip [zlib gzip abcdefghijklm]
108 } abcdefghijklm
110 test zlib-4.2 {zlib gzip/gunzip level and chunk size} {
111     zlib gunzip [zlib gzip abcdefghijklm -level 9] -buffersize 128
112 } abcdefghijklm
114 test zlib-5.1 {zlib crc32} {
115     format %x [expr {[zlib crc32 abcdeabcdeabcdeabcdeabcdeabcde] & 0xffffffff}]
116 } 6f73e901
118 test zlib-5.2 {zlib crc32} {
119     format %x [expr {[zlib crc32 abcdeabcdeabcdeabcdeabcdeabcde 42] & 0xffffffff}]
120 } ce1c4914
122 testreport