Skip to content

Commit e284971

Browse files
committed
np.random.choice: Fixed unit tests
1 parent 5b49510 commit e284971

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

test/NumSharp.UnitTest/Random/np.random.choice.Test.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public void UniformOneSample()
2525
// Verify that all elements in output are within the range
2626
for (int i = 0; i < actual.size; i++)
2727
{
28-
Assert.IsTrue(actual[i] >= low, "Element was less than expected");
29-
Assert.IsTrue(actual[i] < high, "Element was greater than expected");
28+
Assert.IsTrue(actual.GetAtIndex<int>(i) >= low, "Element was less than expected");
29+
Assert.IsTrue(actual.GetAtIndex<int>(i) < high, "Element was greater than expected");
3030
}
3131
}
3232

@@ -46,8 +46,8 @@ public void UniformMultipleSample()
4646
// Verify that all elements in output are within the range
4747
for (int i = 0; i < actual.size; i++)
4848
{
49-
Assert.IsTrue(actual[i] >= low, "Element was less than expected");
50-
Assert.IsTrue(actual[i] < high, "Element was greater than expected");
49+
Assert.IsTrue(actual.GetAtIndex<int>(i) >= low, "Element was less than expected");
50+
Assert.IsTrue(actual.GetAtIndex<int>(i) < high, "Element was greater than expected");
5151
}
5252
}
5353

@@ -67,10 +67,10 @@ public void NonUniformSample()
6767
// Verify that all elements in output are within the range
6868
for (int i = 0; i < actual.size; i++)
6969
{
70-
Assert.IsTrue(actual[i] >= low, "Element was less than expected");
71-
Assert.IsTrue(actual[i] < high, "Element was greater than expected");
72-
Assert.IsTrue(actual[i] != 1, "Sampled zero-probability element");
73-
Assert.IsTrue(actual[i] != 4, "Sampled zero-probability element");
70+
Assert.IsTrue(actual.GetAtIndex<int>(i) >= low, "Element was less than expected");
71+
Assert.IsTrue(actual.GetAtIndex<int>(i) < high, "Element was greater than expected");
72+
Assert.IsTrue(actual.GetAtIndex<int>(i) != 1, "Sampled zero-probability element");
73+
Assert.IsTrue(actual.GetAtIndex<int>(i) != 4, "Sampled zero-probability element");
7474
}
7575
}
7676

0 commit comments

Comments
 (0)