From c5d597c545e31f14322ebdfec4508fec2b8f8795 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 6 Jan 2018 19:50:03 +0100 Subject: [PATCH] Fixed params and names --- .../QuaternionTestDataGenerator.cs | 14 ++++---- tests/OpenTK.Tests.Math/QuaternionTests.cs | 36 ++++++++----------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/tests/OpenTK.Tests.Math/DataProviders/QuaternionTestDataGenerator.cs b/tests/OpenTK.Tests.Math/DataProviders/QuaternionTestDataGenerator.cs index 19dd76ef..c01bb252 100644 --- a/tests/OpenTK.Tests.Math/DataProviders/QuaternionTestDataGenerator.cs +++ b/tests/OpenTK.Tests.Math/DataProviders/QuaternionTestDataGenerator.cs @@ -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 /// /// The single axis test cases. public static IEnumerable 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" } /// /// 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 /// /// The single axis test cases. public static IEnumerable 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" } } diff --git a/tests/OpenTK.Tests.Math/QuaternionTests.cs b/tests/OpenTK.Tests.Math/QuaternionTests.cs index 1f078d32..b6b8a220 100644 --- a/tests/OpenTK.Tests.Math/QuaternionTests.cs +++ b/tests/OpenTK.Tests.Math/QuaternionTests.cs @@ -4,23 +4,22 @@ using OpenTK.Tests.Math.DataProviders; namespace OpenTK.Tests.Math { - public class Quaternion_Tests + public class QuaternionTests { /// - /// Contains all tests which cover the ctor of Quaternion. + /// Contains all tests which cover the constructor of Quaternion. /// - public class Constructor_Tests + public class Constructor { /// /// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion. /// /// euler angle values /// expected xyz component of quaternion - /// Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works. [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 /// /// euler angle values /// expected xyz component of quaternion - /// Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works. [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 /// /// Contains all tests for FromEulerAngles /// - public class FromEulerAngles_Tests + public class FromEulerAngles { /// /// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion. /// /// euler angle values /// expected xyz component of quaternion - /// Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works. [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 /// /// euler angle values /// expected xyz component of quaternion - /// Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works. [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 /// /// euler angle values /// expected xyz component of quaternion - /// Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works. [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 /// /// Prepared Quaternion /// Expected result. - /// Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works. [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;