PageRenderTime 13ms CodeModel.GetById 9ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/tclzlib/tests/zlib.test

http://flightaware-tcltools.googlecode.com/
Unknown | 56 lines | 47 code | 9 blank | 0 comment | 0 complexity | 204c23eecfb16a75092ea02464db1484 MD5 | raw file
Possible License(s): AGPL-3.0
 1# Commands covered:  sha1
 2#
 3# This file contains a collection of tests for one or more of the Tcl
 4# built-in commands.  Sourcing this file into Tcl runs the tests and
 5# generates output for errors.  No output means no errors were found.
 6#
 7# Copyright (c) 2000 by Scriptics Corporation.
 8#
 9# See the file "license.terms" for information on usage and redistribution
10# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11#
12# RCS: @(#) $Id: zlib.test,v 1.1.1.1 2007-11-19 23:31:49 karl Exp $
13
14if {[lsearch [namespace children] ::tcltest] == -1} {
15    package require tcltest
16    namespace import ::tcltest::*
17}
18
19package require zlib
20
21test zlib-1.1 {incorrect command usage} {
22    list [catch {zlib} errMsg] $errMsg
23} {1 {wrong # args: should be "zlib option data ?...?"}}
24
25test zlib-1.2 {adler32 checksum} {
26    zlib adler32 foobar
27} {145425018}
28
29test zlib-1.3 {CRC32 checksum} {
30    zlib crc32 foobar
31} {-1628037227}
32
33test zlib-1.4 {compress / decompress test} {
34    set in "blablablablab"
35    set compressed [zlib compress $in]
36    set out [zlib decompress $compressed]
37    if { ![string equal $in $out] } {
38	return mismatch
39    }
40    return match
41} {match}
42
43test zlib-1.4 {deflate / inflate test} {
44    set in "blablablablab"
45    set compressed [zlib deflate $in]
46    set out [zlib inflate $compressed]
47    if { ![string equal $in $out] } {
48	return mismatch
49    }
50    return match
51} {match}
52
53
54# cleanup
55::tcltest::cleanupTests
56return