File: setfuncs.test

package info (click to toggle)
tclx8.4 8.4.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,800 kB
  • sloc: ansic: 14,863; tcl: 2,090; sh: 265; makefile: 159
file content (163 lines) | stat: -rw-r--r-- 4,168 bytes parent folder | download | duplicates (9)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#
# setfuncs.test
#
# Tests for tcl.tlib set functions.
#---------------------------------------------------------------------------
# Copyright 1992-1999 Karl Lehenbauer and Mark Diekhans.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies.  Karl Lehenbauer and
# Mark Diekhans make no representations about the suitability of this
# software for any purpose.  It is provided "as is" without express or
# implied warranty.
#------------------------------------------------------------------------------
# $Id: setfuncs.test,v 1.2 2002/04/02 02:29:43 hobbs Exp $
#------------------------------------------------------------------------------
#

if {[cequal [info procs Test] {}]} {
    source [file join [file dirname [info script]] testlib.tcl]
}


Test setfuncs-1.1 {union command} {
    union "" ""
} 0 ""

Test setfuncs-1.2 {union command} {
    union a ""
} 0 "a"

Test setfuncs-1.3 {union command} {
    union "a b" "b c"
} 0 "a b c"

Test setfuncs-1.4 {union command} {
    union "a b c d" "a b c d"
} 0 "a b c d"

Test setfuncs-1.5 {union command} {
    union "a d c d b" "b d c a a b d a b c d"
} 0 "a b c d"

Test setfuncs-1.6 {union command} {
    union "d c b a e f" ""
} 0 "a b c d e f"

Test setfuncs-1.7 {union command} {
    union "" "f e d c b a"
} 0 "a b c d e f"

Test setfuncs-1.8 {union command} {
    union "{n p}" "f e d c b a"
} 0 "a b c d e f {n p}"

Test setfuncs-1.9 {union command} {
    union "{n p}" "f e d c {n p} b a"
} 0 "a b c d e f {n p}"

Test setfuncs-1.10 {union command} {
    union "{n p} z {n p} z" "f e d c {n p} b a"
} 0 "a b c d e f {n p} z"

Test setfuncs-2.1 {intersect command} {
    intersect "" ""
} 0 ""

Test setfuncs-2.2 {intersect command} {
    intersect "a b c" ""
} 0 ""

Test setfuncs-2.3 {intersect command} {
    intersect "" "a b c"
} 0 ""

Test setfuncs-2.4 {intersect command} {
    intersect "d f b" "a b c"
} 0 "b"

Test setfuncs-2.5 {intersect command} {
    intersect "a p q d v m b n o z t d f b" "a b c"
} 0 "a b"

Test setfuncs-2.6 {intersect command} {
    intersect "d c b a e f" "{n p}"
} 0 ""

Test setfuncs-2.7 {intersect command} {
    intersect "d c" "f e d c b a"
} 0 "c d"

Test setfuncs-2.8 {intersect command} {
    intersect "a f {n p} e" "f e d c b a"
} 0 "a e f"

Test setfuncs-2.9 {intersect command} {
    intersect "{n p} f d" "f e d c {n p} b a"
} 0 "d f {n p}"

Test setfuncs-2.10 {intersect command} {
    intersect "{n p} z {n p} z" "f e d c {n p} b a"
} 0 "{n p}"

Test setfuncs-3.1 {intersect3 command} {
    intersect3 "" ""
} 0 "{} {} {}"

Test setfuncs-3.2 {intersect3 command} {
    intersect3 "a b c" ""
} 0 "{a b c} {} {}"

Test setfuncs-3.3 {intersect3 command} {
    intersect3 "" "a b c"
} 0 "{} {} {a b c}"

Test setfuncs-3.4 {intersect3 command} {
    intersect3 "d f b" "a b c"
} 0 "{d f} b {a c}"

Test setfuncs-3.5 {intersect3 command} {
    intersect3 "a p q d v m b n o z t d f b" "a b c"
} 0 "{d f m n o p q t v z} {a b} c"

# Multiple elements in a list.
Test setfuncs-3.6 {intersect3 command} {
    intersect3  {aa bb cc dd ee ff} {aa bb cc dd aa bb ee ff}
} 0 {{} {aa bb cc dd ee ff} {}}

Test setfuncs-3.7 {intersect3 command} {
    intersect3  {aa bb cc dd aa bb ee ff} {aa bb cc dd ee ff}
} 0 {{} {aa bb cc dd ee ff} {}}

Test setfuncs-3.8 {intersect3 command} {
    intersect3 {aa XX bb cc dd aa bb ee ff} {aa YY bb cc ZZ dd ee ff}
} 0 {XX {aa bb cc dd ee ff} {YY ZZ}}

Test setfuncs-3.9 {intersect3 command} {
    intersect3 {aa YY bb cc ZZ dd ee ff} {aa XX bb cc dd aa bb ee ff}
} 0 {{YY ZZ} {aa bb cc dd ee ff} XX}

Test setfuncs-4.1 {lrmdups command} {
    lrmdups {a d b c eee b d 1}
} 0 {1 a b c d eee}

Test setfuncs-4.2 {lrmdups command} {
    lrmdups {aaa aaa aaaa aaa aaa }
} 0 {aaa aaaa}

Test setfuncs-4.3 {lrmdups command} {
    lrmdups {{} aaa {} aaa aaa }
} 0 {{} aaa}

Test setfuncs-4.4 {lrmdups command} {
    lrmdups {aaa}
} 0 {aaa}

Test setfuncs-4.5 {lrmdups command} {
    lrmdups [list {ma mb} {mc md} {ma mb}]
} 0 {{ma mb} {mc md}}

# cleanup
::tcltest::cleanupTests
return