File: common.md.test

package info (click to toggle)
tcltrf 2.1.4-dfsg-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 8,308 kB
  • ctags: 9,127
  • sloc: ansic: 72,769; tcl: 1,343; makefile: 222; sh: 89; exp: 22
file content (86 lines) | stat: -rw-r--r-- 2,959 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# -*- tcl -*-
# Commands covered:	none, common behaviour of message digests (dig_opt.c, digest.c)
#
# This file contains a collection of tests for one or more of the commands
# the TRF extension. Sourcing this file into Tcl runs the tests and generates
# output for errors.  No output means no errors were found.
#
# Copyright (c) 1996 Andreas Kupries (andreas_kupries@users.sourceforge.net)
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# $Id: common.md.test,v 1.2 2000/11/18 22:42:33 aku Exp $

if {[string compare test [info procs test]] == 1} then {source defs}

# message digests: adler, crc, crc_zlib, haval, md5, md2, sha, rmd160, rmd128
# tests done with builtin digest 'crc'.

foreach {i opt ovalue} {
    0 mode              absorb
    1 matchflag         XX
    2 write-destination XX
    3 read-destination  XX
} {
    test common.md-1.$i "common md, argument errors" {
	catch {crc -$opt $ovalue -in stdin -out stdout} msg
	set msg
    } {immediate: no options allowed}
}

test common.md-2.0 "common md, argument errors" {
    catch {crc -attach stdout} msg
    set msg
} {attach: -mode not defined}

test common.md-2.1 "common md, argument errors" {
    catch {crc -attach stdout -mode XXX} msg
    set msg
} {unknown mode 'XXX', should be 'absorb', 'write' or 'transparent'}

test common.md-2.2 "common md, argument errors" {
    catch {crc -attach stdin -mode absorb} msg
    set msg
} {attach: -matchflag not defined}

test common.md-2.3 "common md, argument errors" {
    catch {crc -attach stdout -mode write -matchflag XX} msg
    set msg
} {attach: -matchflag not allowed}

test common.md-2.4 "common md, argument errors" {
    catch {crc -attach stdout -mode write} msg
    set msg
} {attach, external: -write-destination missing}

test common.md-2.5 "common md, argument errors" {
    catch {crc -attach stdin -mode write} msg
    set msg
} {attach, external: -read-destination missing}

test common.md-2.6 "common md, argument errors" {
    catch {crc -attach stdout -mode write -write-type XX} msg
    set msg
} {unknown target-type 'XX'}

test common.md-2.7 "common md, argument errors" {
    catch {crc -attach stdout -mode write -write-type channel -write-destination stdin} msg
    set msg
} {write destination channel 'stdin' not opened for writing}

test common.md-2.8 "common md, argument errors" {
    catch {crc -attach stdin -mode write -read-type channel -read-destination stdin} msg
    set msg
} {read destination channel 'stdin' not opened for writing}

test common.md-2.9 "common md, argument errors" {
    catch {crc -attach stdout -mode write -write-type channel -write-destination XXX} msg
    set msg
} {can not find channel named "XXX"}

test common.md-2.10 "common md, argument errors" {
    catch {crc -attach stdin -mode write -read-type channel -read-destination XXX} msg
    set msg
} {can not find channel named "XXX"}