mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 01:55:30 +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.
|
/// Returns the single axis test cases.
|
||||||
/// 1. param: rotation in euler angles
|
/// 1. param: rotation in euler angles
|
||||||
/// 2. param: expected result of xyz-component of quaternion
|
/// 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>
|
/// </summary>
|
||||||
/// <value>The single axis test cases.</value>
|
/// <value>The single axis test cases.</value>
|
||||||
public static IEnumerable<object> SingleAxisTestCases()
|
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(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, 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(0, 0, 1), Vector3.UnitZ}; //"Rotate around z axis"
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the single ToAxisAngle test cases.
|
/// Returns the single ToAxisAngle test cases.
|
||||||
/// 1. param: Quaternion which a definied value of xyz-component.
|
/// 1. param: Quaternion which a definied value of xyz-component.
|
||||||
/// 2. param: expected result of xyz-component of quaternion
|
/// 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>
|
/// </summary>
|
||||||
/// <value>The single axis test cases.</value>
|
/// <value>The single axis test cases.</value>
|
||||||
public static IEnumerable<object[]> ToAxisAngleTestCases()
|
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.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.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.UnitZ, 0), Vector3.UnitZ}; //"Rotate around z axis"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,23 +4,22 @@ using OpenTK.Tests.Math.DataProviders;
|
||||||
|
|
||||||
namespace OpenTK.Tests.Math
|
namespace OpenTK.Tests.Math
|
||||||
{
|
{
|
||||||
public class Quaternion_Tests
|
public class QuaternionTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains all tests which cover the ctor of Quaternion.
|
/// Contains all tests which cover the constructor of Quaternion.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Constructor_Tests
|
public class Constructor
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion.
|
/// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eulerValues">euler angle values</param>
|
/// <param name="eulerValues">euler angle values</param>
|
||||||
/// <param name="expectedResult">expected xyz component of quaternion</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]
|
[Theory]
|
||||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||||
public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectValueInQuaternion
|
public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectQuaternionComponents
|
||||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
(Vector3 eulerValues, Vector3 expectedResult)
|
||||||
{
|
{
|
||||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||||
var cut = new Quaternion(eulerValues.X, eulerValues.Y, eulerValues.Z);
|
var cut = new Quaternion(eulerValues.X, eulerValues.Y, eulerValues.Z);
|
||||||
|
@ -36,11 +35,10 @@ namespace OpenTK.Tests.Math
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eulerValues">euler angle values</param>
|
/// <param name="eulerValues">euler angle values</param>
|
||||||
/// <param name="expectedResult">expected xyz component of quaternion</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]
|
[Theory]
|
||||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||||
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectValueInQuaternion
|
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectQuaternionComponents
|
||||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
(Vector3 eulerValues, Vector3 expectedResult)
|
||||||
{
|
{
|
||||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||||
var cut = new Quaternion(eulerValues);
|
var cut = new Quaternion(eulerValues);
|
||||||
|
@ -57,18 +55,17 @@ namespace OpenTK.Tests.Math
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains all tests for FromEulerAngles
|
/// Contains all tests for FromEulerAngles
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FromEulerAngles_Tests
|
public class FromEulerAngles
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion.
|
/// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eulerValues">euler angle values</param>
|
/// <param name="eulerValues">euler angle values</param>
|
||||||
/// <param name="expectedResult">expected xyz component of quaternion</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]
|
[Theory]
|
||||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||||
public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectValueInQuaternion
|
public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectQuaternionComponents
|
||||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
(Vector3 eulerValues, Vector3 expectedResult)
|
||||||
{
|
{
|
||||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||||
var cut = Quaternion.FromEulerAngles(eulerValues.X, eulerValues.Y, eulerValues.Z);
|
var cut = Quaternion.FromEulerAngles(eulerValues.X, eulerValues.Y, eulerValues.Z);
|
||||||
|
@ -84,11 +81,10 @@ namespace OpenTK.Tests.Math
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eulerValues">euler angle values</param>
|
/// <param name="eulerValues">euler angle values</param>
|
||||||
/// <param name="expectedResult">expected xyz component of quaternion</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]
|
[Theory]
|
||||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||||
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectValueInQuaternion
|
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectQuaternionComponents
|
||||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
(Vector3 eulerValues, Vector3 expectedResult)
|
||||||
{
|
{
|
||||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||||
var cut = Quaternion.FromEulerAngles(eulerValues);
|
var cut = Quaternion.FromEulerAngles(eulerValues);
|
||||||
|
@ -104,11 +100,10 @@ namespace OpenTK.Tests.Math
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eulerValues">euler angle values</param>
|
/// <param name="eulerValues">euler angle values</param>
|
||||||
/// <param name="expectedResult">expected xyz component of quaternion</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]
|
[Theory]
|
||||||
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
||||||
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectValueInQuaternionAsOutParam
|
public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectQuaternionComponentsAsOutParam
|
||||||
(Vector3 eulerValues, Vector3 expectedResult, string testName)
|
(Vector3 eulerValues, Vector3 expectedResult)
|
||||||
{
|
{
|
||||||
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
|
||||||
var cut = Quaternion.Identity;
|
var cut = Quaternion.Identity;
|
||||||
|
@ -134,10 +129,9 @@ namespace OpenTK.Tests.Math
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cut">Prepared Quaternion</param>
|
/// <param name="cut">Prepared Quaternion</param>
|
||||||
/// <param name="expectedResult">Expected result.</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]
|
[Theory]
|
||||||
[MemberData(nameof(QuaternionTestDataGenerator.ToAxisAngleTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
|
[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
|
//Arrange + Act: Create Quaternion with rotation about X/Y/Z axis
|
||||||
Vector3 resultXYZ;
|
Vector3 resultXYZ;
|
||||||
|
|
Loading…
Reference in a new issue