Skip to content

Commit 3afee7c

Browse files
committed
Temp test case
1 parent 4c86e8f commit 3afee7c

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

src/System.Numerics.Vectors/tests/GenericVectorTests.cs

+93
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,99 @@ private void TestConstructor<T>() where T : struct
6060
});
6161
}
6262

63+
[Fact]
64+
public void ConstructorArrayWithCountExceptionByte()
65+
{
66+
for (int counter = 0; counter < 100; ++counter)
67+
{
68+
TestConstructorArrayWithCountException<Byte>();
69+
}
70+
}
71+
[Fact]
72+
public void ConstructorArrayWithCountExceptionSByte()
73+
{
74+
for (int counter = 0; counter < 100; ++counter)
75+
{
76+
TestConstructorArrayWithCountException<SByte>();
77+
}
78+
}
79+
[Fact]
80+
public void ConstructorArrayWithCountExceptionUInt16()
81+
{
82+
for (int counter = 0; counter < 100; ++counter)
83+
{
84+
TestConstructorArrayWithCountException<UInt16>();
85+
}
86+
}
87+
[Fact]
88+
public void ConstructorArrayWithCountExceptionInt16()
89+
{
90+
for (int counter = 0; counter < 100; ++counter)
91+
{
92+
TestConstructorArrayWithCountException<Int16>();
93+
}
94+
}
95+
[Fact]
96+
public void ConstructorArrayWithCountExceptionUInt32()
97+
{
98+
for (int counter = 0; counter < 100; ++counter)
99+
{
100+
TestConstructorArrayWithCountException<UInt32>();
101+
}
102+
}
103+
[Fact]
104+
public void ConstructorArrayWithCountExceptionInt32()
105+
{
106+
for (int counter = 0; counter < 100; ++counter)
107+
{
108+
TestConstructorArrayWithCountException<Int32>();
109+
}
110+
}
111+
[Fact]
112+
public void ConstructorArrayWithCountExceptionUInt64()
113+
{
114+
for (int counter = 0; counter < 100; ++counter)
115+
{
116+
TestConstructorArrayWithCountException<UInt64>();
117+
}
118+
}
119+
[Fact]
120+
public void ConstructorArrayWithCountExceptionInt64()
121+
{
122+
for (int counter = 0; counter < 100; ++counter)
123+
{
124+
TestConstructorArrayWithCountException<Int64>();
125+
}
126+
}
127+
[Fact]
128+
public void ConstructorArrayWithCountExceptionSingle()
129+
{
130+
for (int counter = 0; counter < 100; ++counter)
131+
{
132+
TestConstructorArrayWithCountException<Single>();
133+
}
134+
}
135+
[Fact]
136+
public void ConstructorArrayWithCountExceptionDouble()
137+
{
138+
for (int counter = 0; counter < 100; ++counter)
139+
{
140+
TestConstructorArrayWithCountException<Double>();
141+
}
142+
}
143+
private void TestConstructorArrayWithCountException<T>() where T : struct
144+
{
145+
Assert.Throws<NullReferenceException>(() => new Vector<T>((T[])null, 0));
146+
147+
T[] values = GenerateRandomValuesForVector<T>().ToArray();
148+
var vector = new Vector<T>(values);
149+
ValidateVector(vector,
150+
(index, val) =>
151+
{
152+
Assert.Equal(values[index], val);
153+
});
154+
}
155+
63156
[Fact]
64157
public void ConstructorWithOffsetByte() { TestConstructorWithOffset<Byte>(); }
65158
[Fact]

src/System.Numerics.Vectors/tests/GenericVectorTests.tt

+28
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,34 @@ namespace System.Numerics.Tests
5454
});
5555
}
5656

57+
<#
58+
foreach (var type in supportedTypes)
59+
{
60+
#>
61+
[Fact]
62+
public void ConstructorArrayWithCountException<#=type.Name#>()
63+
{
64+
for (int counter = 0; counter < 100; ++counter)
65+
{
66+
TestConstructorArrayWithCountException<<#=type.Name#>>();
67+
}
68+
}
69+
<#
70+
}
71+
#>
72+
private void TestConstructorArrayWithCountException<T>() where T : struct
73+
{
74+
Assert.Throws<NullReferenceException>(() => new Vector<T>((T[])null, 0));
75+
76+
T[] values = GenerateRandomValuesForVector<T>().ToArray();
77+
var vector = new Vector<T>(values);
78+
ValidateVector(vector,
79+
(index, val) =>
80+
{
81+
Assert.Equal(values[index], val);
82+
});
83+
}
84+
5785
<#
5886
foreach (var type in supportedTypes)
5987
{

0 commit comments

Comments
 (0)