A game about forced loneliness, made by TACStudios
1<#/*THIS IS A T4 FILE - see t4_text_templating.md for what it is and how to run codegen*/#>
2<#@ template debug="True" #>
3<#@ output extension=".gen.cs" #>
4<#@ assembly name="System.Core" #>
5using System;
6using NUnit.Framework;
7using Unity.Collections;
8using Unity.Collections.LowLevel.Unsafe;
9using Unity.Collections.Tests;
10
11internal class NativeParallelHashSetTestsGenerated : CollectionsTestFixture
12{
13<#
14{
15 foreach (var ContainerType in new[] {
16 ( "NativeParallelHashSet" ),
17 ( "UnsafeParallelHashSet" ),
18 }) {
19#>
20 static void ExpectedCount<T>(ref <#=ContainerType#><T> container, int expected)
21 where T : unmanaged, IEquatable<T>
22 {
23 Assert.AreEqual(expected == 0, container.IsEmpty);
24 Assert.AreEqual(expected, container.Count());
25 }
26
27<#
28 foreach (var OtherContainerType in new[] {
29 ( "NativeParallelHashSet" ),
30 ( "UnsafeParallelHashSet" ),
31 ( "NativeList" ),
32 ( "UnsafeList" ),
33 }) {
34#>
35
36 [Test]
37 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_ExceptWith_Empty()
38 {
39 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { };
40 var other = new <#=OtherContainerType#><int>(8, CommonRwdAllocator.Handle) { };
41 container.ExceptWith(other);
42
43 ExpectedCount(ref container, 0);
44
45 container.Dispose();
46 other.Dispose();
47 }
48
49 [Test]
50 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_ExceptWith_AxB()
51 {
52 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { 0, 1, 2, 3, 4, 5 };
53 var other = new <#=OtherContainerType#><int>(8, CommonRwdAllocator.Handle) { 3, 4, 5, 6, 7, 8 };
54 container.ExceptWith(other);
55
56 ExpectedCount(ref container, 3);
57 Assert.True(container.Contains(0));
58 Assert.True(container.Contains(1));
59 Assert.True(container.Contains(2));
60
61 container.Dispose();
62 other.Dispose();
63 }
64
65 [Test]
66 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_IntersectWith_Empty()
67 {
68 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { };
69 var other = new <#=OtherContainerType#><int>(8, CommonRwdAllocator.Handle) { };
70 container.IntersectWith(other);
71
72 ExpectedCount(ref container, 0);
73
74 container.Dispose();
75 other.Dispose();
76 }
77
78 [Test]
79 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_IntersectWith()
80 {
81 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { 0, 1, 2, 3, 4, 5 };
82 var other = new <#=OtherContainerType#><int>(8, CommonRwdAllocator.Handle) { 3, 4, 5, 6, 7, 8 };
83 container.IntersectWith(other);
84
85 ExpectedCount(ref container, 3);
86 Assert.True(container.Contains(3));
87 Assert.True(container.Contains(4));
88 Assert.True(container.Contains(5));
89
90 container.Dispose();
91 other.Dispose();
92 }
93
94 [Test]
95 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_UnionWith_Empty()
96 {
97 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { };
98 var other = new <#=OtherContainerType#><int>(8, CommonRwdAllocator.Handle) { };
99 container.UnionWith(other);
100
101 ExpectedCount(ref container, 0);
102
103 container.Dispose();
104 other.Dispose();
105 }
106
107 [Test]
108 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_UnionWith()
109 {
110 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { 0, 1, 2, 3, 4, 5 };
111 var other = new <#=OtherContainerType#><int>(8, CommonRwdAllocator.Handle) { 3, 4, 5, 6, 7, 8 };
112 container.UnionWith(other);
113
114 ExpectedCount(ref container, 9);
115 Assert.True(container.Contains(0));
116 Assert.True(container.Contains(1));
117 Assert.True(container.Contains(2));
118 Assert.True(container.Contains(3));
119 Assert.True(container.Contains(4));
120 Assert.True(container.Contains(5));
121 Assert.True(container.Contains(6));
122 Assert.True(container.Contains(7));
123 Assert.True(container.Contains(8));
124
125 container.Dispose();
126 other.Dispose();
127 }
128
129<#}#>
130
131<#
132 foreach (var OtherContainerType in new[] {
133 ( "FixedList32Bytes" ),
134 ( "FixedList64Bytes" ),
135 ( "FixedList128Bytes" ),
136 ( "FixedList512Bytes" ),
137 ( "FixedList4096Bytes" ),
138 }) {
139#>
140 [Test]
141 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_ExceptWith_Empty()
142 {
143 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { };
144 var other = new <#=OtherContainerType#><int>() { };
145 container.ExceptWith(other);
146
147 ExpectedCount(ref container, 0);
148
149 container.Dispose();
150 }
151
152 [Test]
153 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_ExceptWith_AxB()
154 {
155 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { 0, 1, 2, 3, 4, 5 };
156 var other = new <#=OtherContainerType#><int>() { 3, 4, 5, 6, 7, 8 };
157 container.ExceptWith(other);
158
159 ExpectedCount(ref container, 3);
160 Assert.True(container.Contains(0));
161 Assert.True(container.Contains(1));
162 Assert.True(container.Contains(2));
163
164 container.Dispose();
165 }
166
167 [Test]
168 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_IntersectWith_Empty()
169 {
170 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { };
171 var other = new <#=OtherContainerType#><int>() { };
172 container.IntersectWith(other);
173
174 ExpectedCount(ref container, 0);
175
176 container.Dispose();
177 }
178
179 [Test]
180 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_IntersectWith()
181 {
182 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { 0, 1, 2, 3, 4, 5 };
183 var other = new <#=OtherContainerType#><int>() { 3, 4, 5, 6, 7, 8 };
184 container.IntersectWith(other);
185
186 ExpectedCount(ref container, 3);
187 Assert.True(container.Contains(3));
188 Assert.True(container.Contains(4));
189 Assert.True(container.Contains(5));
190
191 container.Dispose();
192 }
193
194 [Test]
195 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_UnionWith_Empty()
196 {
197 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { };
198 var other = new <#=OtherContainerType#><int>() { };
199 container.UnionWith(other);
200
201 ExpectedCount(ref container, 0);
202
203 container.Dispose();
204 }
205
206 [Test]
207 public void <#=ContainerType#>_<#=OtherContainerType#>_EIU_UnionWith()
208 {
209 var container = new <#=ContainerType#><int>(8, CommonRwdAllocator.Handle) { 0, 1, 2, 3, 4, 5 };
210 var other = new <#=OtherContainerType#><int>() { 3, 4, 5, 6, 7, 8 };
211 container.UnionWith(other);
212
213 ExpectedCount(ref container, 9);
214 Assert.True(container.Contains(0));
215 Assert.True(container.Contains(1));
216 Assert.True(container.Contains(2));
217 Assert.True(container.Contains(3));
218 Assert.True(container.Contains(4));
219 Assert.True(container.Contains(5));
220 Assert.True(container.Contains(6));
221 Assert.True(container.Contains(7));
222 Assert.True(container.Contains(8));
223
224 container.Dispose();
225 }
226<#}}}#>
227}