benchmark

This commit is contained in:
ikpil 2024-04-30 00:13:42 +09:00
parent 3ae7582043
commit f81975d97a
1 changed files with 7 additions and 1 deletions

View File

@ -29,11 +29,14 @@ namespace DotRecast.Detour.Test;
public class RandomPointTest : AbstractDetourTest public class RandomPointTest : AbstractDetourTest
{ {
[Test] [Test]
[Repeat(10)]
public void TestRandom() public void TestRandom()
{ {
RcRand f = new RcRand(1); RcRand f = new RcRand(1);
IDtQueryFilter filter = new DtQueryDefaultFilter(); IDtQueryFilter filter = new DtQueryDefaultFilter();
for (int i = 0; i < 1000; i++)
var begin = RcFrequency.Ticks;
for (int i = 0; i < 10000; i++)
{ {
var status = query.FindRandomPoint(filter, f, out var randomRef, out var randomPt); var status = query.FindRandomPoint(filter, f, out var randomRef, out var randomPt);
Assert.That(status.Succeeded(), Is.True); Assert.That(status.Succeeded(), Is.True);
@ -55,6 +58,9 @@ public class RandomPointTest : AbstractDetourTest
Assert.That(randomPt.Z >= bmin[1], Is.True); Assert.That(randomPt.Z >= bmin[1], Is.True);
Assert.That(randomPt.Z <= bmax[1], Is.True); Assert.That(randomPt.Z <= bmax[1], Is.True);
} }
var ticks = RcFrequency.Ticks - begin;
Console.WriteLine($"RandomPointTest::TestRandom() - {(double)ticks / TimeSpan.TicksPerMillisecond} ms");
} }
[Test] [Test]