# 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: tclsample.test,v 1.2 2004/12/02 00:35:38 dkf Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest
    namespace import ::tcltest::*
}

package require Tclsha1

test sha-1.1 {incorrect command usage} {
    list [catch {sha1} errMsg] $errMsg
} {1 {wrong # args: should be either:
  sha1 ?-log2base log2base? -string string
 or
  sha1 ?-log2base log2base? ?-copychan chanID? -chan chanID
 or
  sha1 -init (returns descriptor)
  sha1 -update descriptor ?-maxbytes n? ?-copychan chanID? -chan chanID
    (any number of -update calls, returns number of bytes read)
  sha1 ?-log2base log2base? -final descriptor
 The default log2base is 4 (hex)}}

test sha-1.2 {incorrect usage of -log2base option} {
    list [catch {sha1 -log2base 0 -string foo} errMsg] $errMsg
} {1 {parameter to -log2base "0" must be integer in range 1...6}}

# cleanup
::tcltest::cleanupTests
return
