mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Robust.UnitTesting was both ALL tests for RT, and also API surface for content tests. Tests are now split into separate projects as appropriate, and the API side has also been split off.
35 lines
758 B
C#
35 lines
758 B
C#
using System.Runtime.Intrinsics;
|
|
using NUnit.Framework;
|
|
|
|
namespace Robust.Shared.Maths.Tests;
|
|
|
|
[TestFixture]
|
|
[Parallelizable]
|
|
[TestOf(typeof(SimdHelpers))]
|
|
internal sealed class SimdHelpersTest
|
|
{
|
|
[Test]
|
|
public void TestAddHorizontal128()
|
|
{
|
|
var vec = Vector128.Create(1f, 2f, 3f, 4f);
|
|
|
|
var sum = SimdHelpers.AddHorizontal128(vec);
|
|
|
|
var scalar = sum.GetElement(0);
|
|
|
|
Assert.That(scalar, Is.EqualTo(10).Within(0.001f));
|
|
}
|
|
|
|
[Test]
|
|
public void TestAddHorizontal256()
|
|
{
|
|
var vec = Vector256.Create(1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f);
|
|
|
|
var sum = SimdHelpers.AddHorizontal256(vec);
|
|
|
|
var scalar = sum.GetElement(0);
|
|
|
|
Assert.That(scalar, Is.EqualTo(36).Within(0.001f));
|
|
}
|
|
}
|