URL
https://opencores.org/ocsvn/or1k/or1k/trunk
[/] [or1k/] [trunk/] [insight/] [tcl/] [tests/] [llength.test] - Blame information for rev 1765
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
578 |
markom |
# Commands covered: llength
|
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) 1991-1993 The Regents of the University of California.
|
8 |
|
|
# Copyright (c) 1994 Sun Microsystems, Inc.
|
9 |
|
|
#
|
10 |
|
|
# See the file "license.terms" for information on usage and redistribution
|
11 |
|
|
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
12 |
|
|
#
|
13 |
|
|
# RCS: @(#) $Id: llength.test,v 1.1.1.1 2002-01-16 10:25:36 markom Exp $
|
14 |
|
|
|
15 |
|
|
if {[string compare test [info procs test]] == 1} then {source defs}
|
16 |
|
|
|
17 |
|
|
test llength-1.1 {length of list} {
|
18 |
|
|
llength {a b c d}
|
19 |
|
|
} 4
|
20 |
|
|
test llength-1.2 {length of list} {
|
21 |
|
|
llength {a b c {a b {c d}} d}
|
22 |
|
|
} 5
|
23 |
|
|
test llength-1.3 {length of list} {
|
24 |
|
|
llength {}
|
25 |
|
|
} 0
|
26 |
|
|
|
27 |
|
|
test llength-2.1 {error conditions} {
|
28 |
|
|
list [catch {llength} msg] $msg
|
29 |
|
|
} {1 {wrong # args: should be "llength list"}}
|
30 |
|
|
test llength-2.2 {error conditions} {
|
31 |
|
|
list [catch {llength 123 2} msg] $msg
|
32 |
|
|
} {1 {wrong # args: should be "llength list"}}
|
33 |
|
|
test llength-2.3 {error conditions} {
|
34 |
|
|
list [catch {llength "a b c \{"} msg] $msg
|
35 |
|
|
} {1 {unmatched open brace in list}}
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.