summaryrefslogtreecommitdiffstats
path: root/tcllib/modules/struct/graph/tests/ops/eulerpath.test
blob: 1ddcdff01852849c67baa83d9d92a3d21717ac31 (plain)
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# -*- tcl -*-
# Graph ops tests - Euler tours.
# Copyright (c) 2008 Andreas Kupries <andreas_kupries@users.sourceforge.net>
# All rights reserved.
# RCS: @(#) $Id: eulerpath.test,v 1.4 2009/09/15 19:24:12 andreas_kupries Exp $

# Syntax: struct::graph::op::isSemiEulerian? G A

# -------------------------------------------------------------------------
# Wrong # args: Missing, Too many
if 0 {
test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-1.0 {isSemiEulerian?, wrong args, missing} {
    catch {struct::graph::op::isSemiEulerian?} msg
    set msg
} [tcltest::wrongNumArgs struct::graph::op::isSemiEulerian? {g ?eulervar?} 0]

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-1.1 {isSemiEulerian?, wrong args, too many} {
    catch {struct::graph::op::isSemiEulerian? g x y} msg
    set msg
} [tcltest::tooManyArgs struct::graph::op::isSemiEulerian? {g ?eulervar?}]

# -------------------------------------------------------------------------
# Logical arguments checks and failures

# -------------------------------------------------------------------------
# Ok arguments.

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.0 {isSemiEulerian?, empty graph} {
    SETUP
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.1 {isSemiEulerian?, nodes, no arcs} {
    SETUP
    mygraph node insert 0 1 2 3 4 5
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.2 {isSemiEulerian?} {
    SETUP_A
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.3 {isSemiEulerian?} {
    SETUP_B
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 1

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.4 {isSemiEulerian?} {
    SETUP_B2
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 1

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.5 {isSemiEulerian?} {
    SETUP_C
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 1

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.6 {isSemiEulerian?} {
    SETUP_D
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.7 {isSemiEulerian?} {
    SETUP_E
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.8 {isSemiEulerian?} {
    SETUP_F
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.9 {isSemiEulerian?} {
    SETUP_G
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.10 {isSemiEulerian?} {
    SETUP_H
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 1

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.11 {isSemiEulerian?} {
    SETUP_I
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.12 {isSemiEulerian?} {
    SETUP_J
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.13 {isSemiEulerian?} {
    SETUP_K
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.14 {isSemiEulerian?} {
    SETUP_K2
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 1

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.15 {isSemiEulerian?} {
    SETUP_L
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 0

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.16 {isSemiEulerian?} {
    SETUP_M
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 1

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-3.17 {isSemiEulerian?} {
    SETUP_N
    set result [struct::graph::op::isSemiEulerian? mygraph]
    mygraph destroy
    set result
} 1

# ---------------------------------------------------

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-4.3 {isSemiEulerian?, and path} {
    SETUP_B
    set result [struct::graph::op::isSemiEulerian? mygraph path]
    lappend result [EulerPath mygraph $path]
    mygraph destroy
    set result
} {1 ok}

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-4.4 {isSemiEulerian?, and path} {
    SETUP_B2
    set result [struct::graph::op::isSemiEulerian? mygraph path]
    lappend result [EulerPath mygraph $path]
    mygraph destroy
    set result
} {1 ok}
}
test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-4.5 {isSemiEulerian?, and path} -setup {
    SETUP_C
} -body {
    set     result [struct::graph::op::isSemiEulerian? mygraph path]
    lappend result [EulerPath mygraph $path]
    set result
} -cleanup {
    mygraph destroy
} -result {1 ok}
if 0 {
test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-4.10 {isSemiEulerian?, and path} {
    SETUP_H
    set result [struct::graph::op::isSemiEulerian? mygraph path]
    lappend result [EulerPath mygraph $path]
    mygraph destroy
    set result
} {1 ok}

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-4.14 {isSemiEulerian?, and path} {
    SETUP_K2
    set result [struct::graph::op::isSemiEulerian? mygraph path]
    lappend result [EulerPath mygraph $path]
    mygraph destroy
    set result
} {1 ok}

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-4.16 {isSemiEulerian?, and path} {
    SETUP_M
    set result [struct::graph::op::isSemiEulerian? mygraph path]
    lappend result [EulerPath mygraph $path]
    mygraph destroy
    set result
} {1 ok}

test graphop-t${treeimpl}-g${impl}-s${setimpl}-st${stkimpl}-q${queimpl}-isSemiEulerian?-4.17 {isSemiEulerian?, and path} {
    SETUP_N
    set result [struct::graph::op::isSemiEulerian? mygraph path]
    lappend result [EulerPath mygraph $path]
    mygraph destroy
    set result
} {1 ok}
}
# ---------------------------------------------------