/tclzlib/tests/zlib.test
http://flightaware-tcltools.googlecode.com/ · Unknown · 56 lines · 47 code · 9 blank · 0 comment · 0 complexity · 204c23eecfb16a75092ea02464db1484 MD5 · raw file
- # Commands covered: sha1
- #
- # This file contains a collection of tests for one or more of the Tcl
- # built-in commands. Sourcing this file into Tcl runs the tests and
- # generates output for errors. No output means no errors were found.
- #
- # Copyright (c) 2000 by Scriptics Corporation.
- #
- # See the file "license.terms" for information on usage and redistribution
- # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- #
- # RCS: @(#) $Id: zlib.test,v 1.1.1.1 2007-11-19 23:31:49 karl Exp $
- if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
- namespace import ::tcltest::*
- }
- package require zlib
- test zlib-1.1 {incorrect command usage} {
- list [catch {zlib} errMsg] $errMsg
- } {1 {wrong # args: should be "zlib option data ?...?"}}
- test zlib-1.2 {adler32 checksum} {
- zlib adler32 foobar
- } {145425018}
- test zlib-1.3 {CRC32 checksum} {
- zlib crc32 foobar
- } {-1628037227}
- test zlib-1.4 {compress / decompress test} {
- set in "blablablablab"
- set compressed [zlib compress $in]
- set out [zlib decompress $compressed]
- if { ![string equal $in $out] } {
- return mismatch
- }
- return match
- } {match}
- test zlib-1.4 {deflate / inflate test} {
- set in "blablablablab"
- set compressed [zlib deflate $in]
- set out [zlib inflate $compressed]
- if { ![string equal $in $out] } {
- return mismatch
- }
- return match
- } {match}
- # cleanup
- ::tcltest::cleanupTests
- return