-
Notifications
You must be signed in to change notification settings - Fork 587
/
primitiveSetsTest.stg
279 lines (249 loc) · 21.5 KB
/
primitiveSetsTest.stg
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
import "copyrightAndOthers.stg"
import "primitiveHashCode.stg"
import "primitiveLiteral.stg"
isTest() ::= "true"
targetPath() ::= "org/eclipse/collections/impl/factory/primitive"
fileName(primitive) ::= "<primitive.name>SetsTest"
class(primitive) ::= <<
<body(primitive.type, primitive.wrapperName, primitive.name)>
>>
body(type, wrapperName, name) ::= <<
<copyrightAndOthers()>
package org.eclipse.collections.impl.factory.primitive;
import java.util.Set;
import org.eclipse.collections.api.LazyIterable;
import org.eclipse.collections.api.set.primitive.Immutable<name>Set;
import org.eclipse.collections.api.set.primitive.Mutable<name>Set;
import org.eclipse.collections.api.factory.set.primitive.Immutable<name>SetFactory;
import org.eclipse.collections.api.factory.set.primitive.Mutable<name>SetFactory;
import org.eclipse.collections.api.tuple.primitive.<name><name>Pair;
import org.eclipse.collections.impl.factory.Lists;
import org.eclipse.collections.impl.factory.Sets;
import org.eclipse.collections.impl.set.mutable.primitive.<name>HashSet;
import org.eclipse.collections.impl.test.Verify;
import org.eclipse.collections.impl.tuple.primitive.PrimitiveTuples;
import org.junit.Assert;
import org.junit.Test;
/**
* Junit test for {@link <name>Sets}
* This file was automatically generated from template file primitiveSetsTest.stg
*/
public class <name>SetsTest
{
@Test
public void immutables()
{
this.assertImmutableSetFactory(<name>Sets.immutable);
this.assertImmutableSetFactory(org.eclipse.collections.api.factory.primitive.<name>Sets.immutable);
}
private void assertImmutableSetFactory(Immutable<name>SetFactory setFactory)
{
Assert.assertEquals(<name>HashSet.newSetWith(), setFactory.empty());
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.empty());
Assert.assertEquals(<name>HashSet.newSetWith(<(literal.(type))("1")>), setFactory.with(<(literal.(type))("1")>));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<(literal.(type))("1")>));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<["1", "2"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<["1", "2", "3"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6", "7"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6", "7"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6", "7"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6", "7", "8"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6", "7", "8", "9"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">), setFactory.withAll(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">)));
Verify.assertInstanceOf(Immutable<name>Set.class, setFactory.withAll(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">)));
}
@Test
public void mutables()
{
this.assertMutableSetFactory(<name>Sets.mutable);
this.assertMutableSetFactory(org.eclipse.collections.api.factory.primitive.<name>Sets.mutable);
}
private void assertMutableSetFactory(Mutable<name>SetFactory setFactory)
{
Assert.assertEquals(<name>HashSet.newSetWith(), setFactory.empty());
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.empty());
Assert.assertEquals(<name>HashSet.newSetWith(<(literal.(type))("1")>), setFactory.with(<(literal.(type))("1")>));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<(literal.(type))("1")>));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<["1", "2"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<["1", "2", "3"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6", "7"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6", "7"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6", "7"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6", "7", "8"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6", "7", "8", "9"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]:(literal.(type))(); separator=", ">), setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]:(literal.(type))(); separator=", ">));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">), setFactory.withAll(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">)));
Verify.assertInstanceOf(Mutable<name>Set.class, setFactory.withAll(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">)));
}
@Test
public void emptySet()
{
Assert.assertTrue(<name>Sets.immutable.empty().isEmpty());
}
@Test
public void newSetWith()
{
Immutable<name>Set set = <name>Sets.immutable.empty();
Assert.assertEquals(set, <name>Sets.immutable.of(set.toArray()));
Assert.assertEquals(set = set.newWith(<(literal.(type))("1")>), <name>Sets.immutable.with(<(literal.(type))("1")>));
Assert.assertEquals(set = set.newWith(<(literal.(type))("2")>), <name>Sets.immutable.with(<["1", "2"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(set = set.newWith(<(literal.(type))("3")>), <name>Sets.immutable.with(<["1", "2", "3"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(set = set.newWith(<(literal.(type))("4")>), <name>Sets.immutable.with(<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(set = set.newWith(<(literal.(type))("5")>), <name>Sets.immutable.with(<["1", "2", "3", "4", "5"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(set = set.newWith(<(literal.(type))("6")>), <name>Sets.immutable.with(<["1", "2", "3", "4", "5", "6"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(set = set.newWith(<(literal.(type))("7")>), <name>Sets.immutable.with(<["1", "2", "3", "4", "5", "6", "7"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(set = set.newWith(<(literal.(type))("8")>), <name>Sets.immutable.with(<["1", "2", "3", "4", "5", "6", "7", "8"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(set = set.newWith(<(literal.(type))("9")>), <name>Sets.immutable.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(set = set.newWith(<(literal.(type))("10")>), <name>Sets.immutable.with(<["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]:(literal.(type))(); separator=", ">));
}
@SuppressWarnings("RedundantArrayCreation")
@Test
public void newSetWithArray_immutable()
{
Immutable<name>Set set = <name>Sets.immutable.empty();
Assert.assertEquals(set = set.newWith(<(literal.(type))("1")>), <name>Sets.immutable.with(new <type>[]{<(literal.(type))("1")>}));
Assert.assertEquals(set = set.newWith(<(literal.(type))("2")>), <name>Sets.immutable.with(new <type>[]{<["1", "2"]:(literal.(type))(); separator=", ">}));
Assert.assertEquals(set = set.newWith(<(literal.(type))("3")>), <name>Sets.immutable.with(new <type>[]{<["1", "2", "3"]:(literal.(type))(); separator=", ">}));
Assert.assertEquals(set = set.newWith(<(literal.(type))("4")>), <name>Sets.immutable.with(new <type>[]{<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">}));
Assert.assertEquals(set = set.newWith(<(literal.(type))("5")>), <name>Sets.immutable.with(new <type>[]{<["1", "2", "3", "4", "5"]:(literal.(type))(); separator=", ">}));
Assert.assertEquals(set = set.newWith(<(literal.(type))("6")>), <name>Sets.immutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6"]:(literal.(type))(); separator=", ">}));
Assert.assertEquals(set = set.newWith(<(literal.(type))("7")>), <name>Sets.immutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6", "7"]:(literal.(type))(); separator=", ">}));
Assert.assertEquals(set = set.newWith(<(literal.(type))("8")>), <name>Sets.immutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6", "7", "8"]:(literal.(type))(); separator=", ">}));
Assert.assertEquals(set = set.newWith(<(literal.(type))("9")>), <name>Sets.immutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6", "7", "8", "9"]:(literal.(type))(); separator=", ">}));
Assert.assertEquals(set = set.newWith(<(literal.(type))("10")>), <name>Sets.immutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]:(literal.(type))(); separator=", ">}));
}
@SuppressWarnings("RedundantArrayCreation")
@Test
public void newSetWithArray_mutable()
{
Mutable<name>Set set = <name>Sets.mutable.empty();
Assert.assertEquals(set, <name>Sets.mutable.with(null));
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{}));
set.add(<(literal.(type))("1")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<(literal.(type))("1")>}));
set.add(<(literal.(type))("2")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<["1", "2"]:(literal.(type))(); separator=", ">}));
set.add(<(literal.(type))("3")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<["1", "2", "3"]:(literal.(type))(); separator=", ">}));
set.add(<(literal.(type))("4")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">}));
set.add(<(literal.(type))("5")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<["1", "2", "3", "4", "5"]:(literal.(type))(); separator=", ">}));
set.add(<(literal.(type))("6")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6"]:(literal.(type))(); separator=", ">}));
set.add(<(literal.(type))("7")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6", "7"]:(literal.(type))(); separator=", ">}));
set.add(<(literal.(type))("8")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6", "7", "8"]:(literal.(type))(); separator=", ">}));
set.add(<(literal.(type))("9")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6", "7", "8", "9"]:(literal.(type))(); separator=", ">}));
set.add(<(literal.(type))("10")>);
Assert.assertEquals(set, <name>Sets.mutable.with(new <type>[]{<["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]:(literal.(type))(); separator=", ">}));
}
@Test
public void newSetWithSet()
{
Immutable<name>Set set = <name>Sets.immutable.empty();
<name>HashSet hashSet = <name>HashSet.newSetWith(<(literal.(type))("1")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("1")>), hashSet.toImmutable());
hashSet.add(<(literal.(type))("2")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("2")>), hashSet.toImmutable());
hashSet.add(<(literal.(type))("3")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("3")>), hashSet.toImmutable());
hashSet.add(<(literal.(type))("4")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("4")>), hashSet.toImmutable());
hashSet.add(<(literal.(type))("5")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("5")>), hashSet.toImmutable());
hashSet.add(<(literal.(type))("6")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("6")>), hashSet.toImmutable());
hashSet.add(<(literal.(type))("7")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("7")>), hashSet.toImmutable());
hashSet.add(<(literal.(type))("8")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("8")>), hashSet.toImmutable());
hashSet.add(<(literal.(type))("9")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("9")>), hashSet.toImmutable());
hashSet.add(<(literal.(type))("10")>);
Assert.assertEquals(set = set.newWith(<(literal.(type))("10")>), hashSet.toImmutable());
}
@Test
public void ofAllIterable()
{
Assert.assertEquals(new <name>HashSet(), <name>Sets.immutable.ofAll(Lists.mutable.\<<wrapperName>\>empty()));
Assert.assertEquals(<name>HashSet.newSetWith(<(literal.(type))("1")>), <name>Sets.immutable.ofAll(Lists.mutable.\<<wrapperName>\>with(<(literal.(type))("1")>)));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2"]:(literal.(type))(); separator=", ">), <name>Sets.immutable.ofAll(Lists.mutable.\<<wrapperName>\>with(<["1", "2"]:(literal.(type))(); separator=", ">)));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">), <name>Sets.immutable.ofAll(Lists.mutable.\<<wrapperName>\>with(<["1", "2", "2", "3"]:(literal.(type))(); separator=", ">)));
Assert.assertEquals(new <name>HashSet(), <name>Sets.mutable.ofAll(Lists.mutable.\<<wrapperName>\>empty()));
Assert.assertEquals(<name>HashSet.newSetWith(<(literal.(type))("1")>), <name>Sets.mutable.ofAll(Lists.mutable.\<<wrapperName>\>with(<(literal.(type))("1")>)));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2"]:(literal.(type))(); separator=", ">), <name>Sets.mutable.ofAll(Lists.mutable.\<<wrapperName>\>with(<["1", "2"]:(literal.(type))(); separator=", ">)));
Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">), <name>Sets.mutable.ofAll(Lists.mutable.\<<wrapperName>\>with(<["1", "2", "2", "3"]:(literal.(type))(); separator=", ">)));
}
@Test
public void classIsNonInstantiable()
{
Verify.assertClassNonInstantiable(<name>Sets.class);
}
@Test
public void cartesianProduct()
{
LazyIterable\<<name><name>Pair> <type><name>Pairs1 =
<name>Sets.cartesianProduct(
<name>Sets.mutable.with(<["1", "2"]:(literal.(type))(); separator=", ">),
<name>Sets.mutable.with(<["3", "4", "5"]:(literal.(type))(); separator=", ">));
Set\<<name><name>Pair> expected1 = Sets.mutable.with(
PrimitiveTuples.pair(<["1", "3"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["1", "4"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["1", "5"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["2", "3"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["2", "4"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["2", "5"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(expected1, <type><name>Pairs1.toSet());
LazyIterable\<<name><name>Pair> <type><name>Pairs2 =
<name>Sets.cartesianProduct(
<name>Sets.mutable.with(<["3", "4", "5"]:(literal.(type))(); separator=", ">),
<name>Sets.mutable.with(<["1", "2"]:(literal.(type))(); separator=", ">));
Set\<<name><name>Pair> expected2 = Sets.mutable.with(
PrimitiveTuples.pair(<["3", "1"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["3", "2"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["4", "1"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["4", "2"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["5", "1"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["5", "2"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(expected2, <type><name>Pairs2.toSet());
}
@Test
public void cartesianProductSameElements()
{
LazyIterable\<<name><name>Pair> <type><name>Pairs =
<name>Sets.cartesianProduct(
<name>Sets.mutable.with(<["1", "2"]:(literal.(type))(); separator=", ">),
<name>Sets.mutable.with(<["1", "2"]:(literal.(type))(); separator=", ">));
Set\<<name><name>Pair> expected = Sets.mutable.with(
PrimitiveTuples.pair(<["1", "1"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["1", "2"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["2", "2"]:(literal.(type))(); separator=", ">),
PrimitiveTuples.pair(<["2", "1"]:(literal.(type))(); separator=", ">));
Assert.assertEquals(expected, <type><name>Pairs.toSet());
}
}
>>