mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-22 20:45:38 +00:00
Fixed params and names
This commit is contained in:
parent
a875bfe6b9
commit
c5d597c545
|
@ -11,28 +11,26 @@ namespace OpenTK.Tests.Math.DataProviders
|
|||
/// Returns the single axis test cases.
|
||||
/// 1. param: rotation in euler angles
|
||||
/// 2. param: expected result of xyz-component of quaternion
|
||||
/// 3. param: test name (Don't found a working way how to pass this to xUnit runner). I let it here for test documentation
|
||||
/// </summary>
|
||||
/// <value>The single axis test cases.</value>
|
||||
public static IEnumerable<object> SingleAxisTestCases()
|
||||
{
|
||||
yield return new object[] { new Vector3(1, 0, 0), Vector3.UnitX, "Rotate around x axis" };
|
||||
yield return new object[] { new Vector3(0, 1, 0), Vector3.UnitY, "Rotate around y axis" };
|
||||
yield return new object[] { new Vector3(0, 0, 1), Vector3.UnitZ, "Rotate around z axis" };
|
||||
yield return new object[] { new Vector3(1, 0, 0), Vector3.UnitX}; //"Rotate around x axis"
|
||||
yield return new object[] { new Vector3(0, 1, 0), Vector3.UnitY}; //"Rotate around y axis"
|
||||
yield return new object[] { new Vector3(0, 0, 1), Vector3.UnitZ}; //"Rotate around z axis"
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the single ToAxisAngle test cases.
|
||||
/// 1. param: Quaternion which a definied value of xyz-component.
|
||||
/// 2. param: expected result of xyz-component of quaternion
|
||||
/// 3. param: test name (Don't found a working way how to pass this to xUnit runner). I let it here for test documentation
|
||||
/// </summary>
|
||||
/// <value>The single axis test cases.</value>
|
||||
public static IEnumerable<object[]> ToAxisAngleTestCases()
|
||||
{
|
||||
yield return new object[] { new Quaternion(Vector3.UnitX, 0), Vector3.UnitX, "Rotate around x axis" };
|
||||
yield return new object[] { new Quaternion(Vector3.UnitY, 0), Vector3.UnitY, "Rotate around y axis" };
|
||||
yield return new object[] { new Quaternion(Vector3.UnitZ, 0), Vector3.UnitZ, "Rotate around z axis" };
|
||||
yield return new object[] { new Quaternion(Vector3.UnitX, 0), Vector3.UnitX}; //"Rotate around x axis"
|
||||
yield return new object[] { new Quaternion(Vector3.UnitY, 0), Vector3.UnitY}; //"Rotate around y axis"
|
||||
yield return new object[] { new Quaternion(Vector3.UnitZ, 0), Vector3.UnitZ}; //"Rotate around z axis"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,23 +4,22 @@ using OpenTK.Tests.Math.DataProviders;
|
|||
|
||||
namespace OpenTK.Tests.Math
|
||||
{
|
||||
public class Quaternion_Tests
|
||||
public class QuaternionTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains all tests which cover the ctor of Quaternion.
|
||||
/// Contains all tests which cover the constructor of Quaternion.
|
||||
/// </summary>
|
||||
public class Constructor_Tests
|
||||
public class Constructor
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion.
|
||||
/// </summary>
|
||||
/// <param name="eulerValues">euler angle values</param>
|
||||
/// <param name="expectedResult">expected xyz component of quaternion</param>
|
||||
/// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
|
||||
[Theory]
|
||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||
public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectValueInQuaternion
|
||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
||||
public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectQuaternionComponents
|
||||
(Vector3 eulerValues, Vector3 expectedResult)
|
||||
{
|
||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||
var cut = new Quaternion(eulerValues.X, eulerValues.Y, eulerValues.Z);
|
||||
|
@ -36,11 +35,10 @@ namespace OpenTK.Tests.Math
|
|||
/// </summary>
|
||||
/// <param name="eulerValues">euler angle values</param>
|
||||
/// <param name="expectedResult">expected xyz component of quaternion</param>
|
||||
/// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
|
||||
[Theory]
|
||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectValueInQuaternion
|
||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
||||
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectQuaternionComponents
|
||||
(Vector3 eulerValues, Vector3 expectedResult)
|
||||
{
|
||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||
var cut = new Quaternion(eulerValues);
|
||||
|
@ -57,18 +55,17 @@ namespace OpenTK.Tests.Math
|
|||
/// <summary>
|
||||
/// Contains all tests for FromEulerAngles
|
||||
/// </summary>
|
||||
public class FromEulerAngles_Tests
|
||||
public class FromEulerAngles
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion.
|
||||
/// </summary>
|
||||
/// <param name="eulerValues">euler angle values</param>
|
||||
/// <param name="expectedResult">expected xyz component of quaternion</param>
|
||||
/// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
|
||||
[Theory]
|
||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||
public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectValueInQuaternion
|
||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
||||
public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectQuaternionComponents
|
||||
(Vector3 eulerValues, Vector3 expectedResult)
|
||||
{
|
||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||
var cut = Quaternion.FromEulerAngles(eulerValues.X, eulerValues.Y, eulerValues.Z);
|
||||
|
@ -84,11 +81,10 @@ namespace OpenTK.Tests.Math
|
|||
/// </summary>
|
||||
/// <param name="eulerValues">euler angle values</param>
|
||||
/// <param name="expectedResult">expected xyz component of quaternion</param>
|
||||
/// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
|
||||
[Theory]
|
||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectValueInQuaternion
|
||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
||||
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectQuaternionComponents
|
||||
(Vector3 eulerValues, Vector3 expectedResult)
|
||||
{
|
||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||
var cut = Quaternion.FromEulerAngles(eulerValues);
|
||||
|
@ -104,11 +100,10 @@ namespace OpenTK.Tests.Math
|
|||
/// </summary>
|
||||
/// <param name="eulerValues">euler angle values</param>
|
||||
/// <param name="expectedResult">expected xyz component of quaternion</param>
|
||||
/// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
|
||||
[Theory]
|
||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectValueInQuaternionAsOutParam
|
||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
||||
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectQuaternionComponentsAsOutParam
|
||||
(Vector3 eulerValues, Vector3 expectedResult)
|
||||
{
|
||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||
var cut = Quaternion.Identity;
|
||||
|
@ -134,10 +129,9 @@ namespace OpenTK.Tests.Math
|
|||
/// </summary>
|
||||
/// <param name="cut">Prepared Quaternion</param>
|
||||
/// <param name="expectedResult">Expected result.</param>
|
||||
/// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
|
||||
[Theory]
|
||||
[MemberData(nameof(QuaternionTestDataGenerator.ToAxisAngleTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||
public void PreparedSingleRotationAxisQuaternionConvertsToCorrectAxisAngleRepresentation(Quaternion cut, Vector3 expectedResult, string testName)
|
||||
public void PreparedSingleRotationAxisQuaternionConvertsToCorrectAxisAngleRepresentation(Quaternion cut, Vector3 expectedResult)
|
||||
{
|
||||
//Arrange + Act: Create Quaternion with rotation about X/Y/Z axis
|
||||
Vector3 resultXYZ;
|
||||
|
|
Loading…
Reference in a new issue