Remove duplicate test files
This commit is contained in:
parent
8e3986174e
commit
1b6fdd28ca
5 changed files with 0 additions and 855 deletions
|
@ -1,289 +0,0 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
using OpenTK;
|
||||
|
||||
namespace NUnitTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class Matrix4Test
|
||||
{
|
||||
[Test]
|
||||
public void Matrix4_SixteenValueConstructor()
|
||||
{
|
||||
Matrix4 A = new Matrix4( 0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15);
|
||||
|
||||
Assert.AreEqual(0, A.M11);
|
||||
Assert.AreEqual(1, A.M12);
|
||||
Assert.AreEqual(2, A.M13);
|
||||
Assert.AreEqual(3, A.M14);
|
||||
|
||||
Assert.AreEqual(4, A.M21);
|
||||
Assert.AreEqual(5, A.M22);
|
||||
Assert.AreEqual(6, A.M23);
|
||||
Assert.AreEqual(7, A.M24);
|
||||
|
||||
Assert.AreEqual(8, A.M31);
|
||||
Assert.AreEqual(9, A.M32);
|
||||
Assert.AreEqual(10, A.M33);
|
||||
Assert.AreEqual(11, A.M34);
|
||||
|
||||
Assert.AreEqual(12, A.M41);
|
||||
Assert.AreEqual(13, A.M42);
|
||||
Assert.AreEqual(14, A.M43);
|
||||
Assert.AreEqual(15, A.M44);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Matrix4_Matrix3Constructor()
|
||||
{
|
||||
Matrix3 B = new Matrix3( 1, 2, 3,
|
||||
4, 5, 6,
|
||||
7, 8, 9);
|
||||
|
||||
Matrix4 A = new Matrix4(B);
|
||||
|
||||
Assert.AreEqual(B.M11, A.M11);
|
||||
Assert.AreEqual(B.M12, A.M12);
|
||||
Assert.AreEqual(B.M13, A.M13);
|
||||
|
||||
Assert.AreEqual(B.M21, A.M21);
|
||||
Assert.AreEqual(B.M22, A.M22);
|
||||
Assert.AreEqual(B.M23, A.M23);
|
||||
|
||||
Assert.AreEqual(B.M31, A.M31);
|
||||
Assert.AreEqual(B.M32, A.M32);
|
||||
Assert.AreEqual(B.M33, A.M33);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Matrix4_FourVector4Constructor()
|
||||
{
|
||||
Vector4 V = new Vector4(1, 2, 3, 4);
|
||||
Vector4 U = new Vector4(5, 6, 7, 8);
|
||||
Vector4 S = new Vector4(9, 10, 11, 12);
|
||||
Vector4 T = new Vector4(13, 14, 15, 16);
|
||||
|
||||
Matrix4 A = new Matrix4(V, U, S, T);
|
||||
|
||||
Assert.AreEqual(V.X, A.M11);
|
||||
Assert.AreEqual(V.Y, A.M12);
|
||||
Assert.AreEqual(V.Z, A.M13);
|
||||
Assert.AreEqual(V.W, A.M14);
|
||||
|
||||
Assert.AreEqual(U.X, A.M21);
|
||||
Assert.AreEqual(U.Y, A.M22);
|
||||
Assert.AreEqual(U.Z, A.M23);
|
||||
Assert.AreEqual(U.W, A.M24);
|
||||
|
||||
Assert.AreEqual(S.X, A.M31);
|
||||
Assert.AreEqual(S.Y, A.M32);
|
||||
Assert.AreEqual(S.Z, A.M33);
|
||||
Assert.AreEqual(S.W, A.M34);
|
||||
|
||||
Assert.AreEqual(T.X, A.M41);
|
||||
Assert.AreEqual(T.Y, A.M42);
|
||||
Assert.AreEqual(T.Z, A.M43);
|
||||
Assert.AreEqual(T.W, A.M44);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Matrix4_Equal_operator()
|
||||
{
|
||||
Matrix4 A = new Matrix4( 0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15);
|
||||
|
||||
Matrix4 B = new Matrix4( 0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15);
|
||||
|
||||
Assert.IsTrue(A == B);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Matrix4_Matrix4TimesMatrix4_operator()
|
||||
{
|
||||
Matrix4 A = new Matrix4( 0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15);
|
||||
|
||||
Matrix4 B = new Matrix4( 0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15);
|
||||
|
||||
Matrix4 expected = new Matrix4( 56, 62, 68, 74,
|
||||
152, 174, 196, 218,
|
||||
248, 286, 324, 362,
|
||||
344, 398, 452, 506);
|
||||
|
||||
Matrix4 result = A * B;
|
||||
Assert.IsTrue(expected == result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Matrix4_Matrix4PlusMatrix4_operator()
|
||||
{
|
||||
Matrix4 A = new Matrix4( 0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15);
|
||||
|
||||
Matrix4 B = new Matrix4( 0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15);
|
||||
|
||||
Matrix4 expected = new Matrix4( 0, 2, 4, 6,
|
||||
8, 10, 12, 14,
|
||||
16, 18, 20, 22,
|
||||
24, 26, 28, 30);
|
||||
|
||||
Matrix4 result = A + B;
|
||||
Assert.IsTrue(expected == result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Matrix4_Matrix4MinusMatrix4_operator()
|
||||
{
|
||||
Matrix4 A = new Matrix4( 0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15);
|
||||
|
||||
Matrix4 B = new Matrix4( 0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15);
|
||||
|
||||
Matrix4 expected = new Matrix4( 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0);
|
||||
|
||||
Matrix4 result = A - B;
|
||||
Assert.IsTrue(expected == result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Matrix4_Index_Operator()
|
||||
{
|
||||
Matrix4 A = new Matrix4();
|
||||
A[0, 0] = 0;
|
||||
A[0, 1] = 1;
|
||||
A[0, 2] = 2;
|
||||
A[0, 3] = 3;
|
||||
A[1, 0] = 4;
|
||||
A[1, 1] = 5;
|
||||
A[1, 2] = 6;
|
||||
A[1, 3] = 7;
|
||||
A[2, 0] = 8;
|
||||
A[2, 1] = 9;
|
||||
A[2, 2] = 10;
|
||||
A[2, 3] = 11;
|
||||
A[3, 0] = 12;
|
||||
A[3, 1] = 13;
|
||||
A[3, 2] = 14;
|
||||
A[3, 3] = 15;
|
||||
Assert.AreEqual(0, A[0, 0]);
|
||||
Assert.AreEqual(1, A[0, 1]);
|
||||
Assert.AreEqual(2, A[0, 2]);
|
||||
Assert.AreEqual(3, A[0, 3]);
|
||||
Assert.AreEqual(4, A[1, 0]);
|
||||
Assert.AreEqual(5, A[1, 1]);
|
||||
Assert.AreEqual(6, A[1, 2]);
|
||||
Assert.AreEqual(7, A[1, 3]);
|
||||
Assert.AreEqual(8, A[2, 0]);
|
||||
Assert.AreEqual(9, A[2, 1]);
|
||||
Assert.AreEqual(10, A[2, 2]);
|
||||
Assert.AreEqual(11, A[2, 3]);
|
||||
Assert.AreEqual(12, A[3, 0]);
|
||||
Assert.AreEqual(13, A[3, 1]);
|
||||
Assert.AreEqual(14, A[3, 2]);
|
||||
Assert.AreEqual(15, A[3, 3]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Matrix4_Index_NegativeIndexException()
|
||||
{
|
||||
Matrix4 A = new Matrix4();
|
||||
bool negativeIndexException = false;
|
||||
try
|
||||
{
|
||||
A[-1, 2] = 0;
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
negativeIndexException = true;
|
||||
}
|
||||
Assert.IsTrue(negativeIndexException);
|
||||
|
||||
negativeIndexException = false;
|
||||
try
|
||||
{
|
||||
A[1, -2] = 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
negativeIndexException = true;
|
||||
}
|
||||
Assert.IsTrue(negativeIndexException);
|
||||
|
||||
negativeIndexException = false;
|
||||
try
|
||||
{
|
||||
A[-1, -2] = 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
negativeIndexException = true;
|
||||
}
|
||||
Assert.IsTrue(negativeIndexException);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Matrix4_Index_LargeIndexException()
|
||||
{
|
||||
Matrix4 A = new Matrix4();
|
||||
bool largeIndexException = false;
|
||||
try
|
||||
{
|
||||
A[5, 2] = 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
largeIndexException = true;
|
||||
}
|
||||
Assert.IsTrue(largeIndexException);
|
||||
|
||||
largeIndexException = false;
|
||||
try
|
||||
{
|
||||
A[1, 6] = 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
largeIndexException = true;
|
||||
}
|
||||
Assert.IsTrue(largeIndexException);
|
||||
|
||||
largeIndexException = false;
|
||||
try
|
||||
{
|
||||
A[7, 12] = 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
largeIndexException = true;
|
||||
}
|
||||
Assert.IsTrue(largeIndexException);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{930A780C-A67C-422F-9EED-DB38DAA47AB0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NUnitTests</RootNamespace>
|
||||
<AssemblyName>NUnitTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.core, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.core.interfaces, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.util, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.VisualStudio.TestAdapter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4cb40d35494691ac, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Matrix4Test.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Vector3Tests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenTK\OpenTK.csproj">
|
||||
<Project>{a37a7e14-0000-0000-0000-000000000000}</Project>
|
||||
<Name>OpenTK</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -1,36 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NUnitTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NUnitTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8a03c40d-007c-4a15-ab0c-2111969ea6df")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,439 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using OpenTK;
|
||||
|
||||
namespace NUnitTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class Vector3Tests
|
||||
{
|
||||
[Test]
|
||||
public void Vector3_SingleValueConstructor()
|
||||
{
|
||||
Vector3 V = new Vector3(1);
|
||||
Assert.AreEqual(1, V.X);
|
||||
Assert.AreEqual(1, V.Y);
|
||||
Assert.AreEqual(1, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_ThreeValueConstructor()
|
||||
{
|
||||
Vector3 V = new Vector3(1,2,3);
|
||||
Assert.AreEqual(1, V.X);
|
||||
Assert.AreEqual(2, V.Y);
|
||||
Assert.AreEqual(3, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Vector2Constructor()
|
||||
{
|
||||
Vector2 T = new Vector2(1, 2);
|
||||
Vector3 V = new Vector3(T);
|
||||
Assert.AreEqual(T.X, V.X);
|
||||
Assert.AreEqual(T.Y, V.Y);
|
||||
Assert.AreEqual(0, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Vector3Constructor()
|
||||
{
|
||||
Vector3 U = new Vector3(1, 2, 3);
|
||||
Vector3 V = new Vector3(U);
|
||||
Assert.IsTrue(U == V);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Vector4Constructor()
|
||||
{
|
||||
Vector4 T = new Vector4(1, 2, 3, 0);
|
||||
Vector3 V = new Vector3(T);
|
||||
Assert.AreEqual(T.X, V.X);
|
||||
Assert.AreEqual(T.Y, V.Y);
|
||||
Assert.AreEqual(T.Z, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Index_operator()
|
||||
{
|
||||
Vector3 V = new Vector3();
|
||||
V[0] = 1; V[1] = 2; V[2] = 3;
|
||||
Assert.AreEqual(1, V[0]);
|
||||
Assert.AreEqual(2, V[1]);
|
||||
Assert.AreEqual(3, V[2]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Index_NegativeExceptin()
|
||||
{
|
||||
//the syntax for an expected exception changes from
|
||||
//NUnit 2.6.4 / Microsoft Unit Test to NUnit 3+
|
||||
//but a try-catch block is always guaranteed to work
|
||||
Vector3 V = new Vector3();
|
||||
bool negativeIndexExceptionFound = false;
|
||||
try
|
||||
{
|
||||
V[-1] = 5;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
negativeIndexExceptionFound = true;
|
||||
}
|
||||
Assert.IsTrue(negativeIndexExceptionFound);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Index_LargeIndexExceptin()
|
||||
{
|
||||
//the syntax for an expected exception changes from
|
||||
//NUnit 2.6.4 / Microsoft Unit Test to NUnit 3+
|
||||
//but a try-catch block is always guaranteed to work
|
||||
Vector3 V = new Vector3();
|
||||
bool largeIndexExceptionFound = false;
|
||||
try
|
||||
{
|
||||
V[3] = 6;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
largeIndexExceptionFound = true;
|
||||
}
|
||||
Assert.IsTrue(largeIndexExceptionFound);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Length()
|
||||
{
|
||||
float X = 1, Y = 2, Z = 2;
|
||||
Vector3 U = new Vector3(X, Y, Z);
|
||||
Assert.AreEqual((float)System.Math.Sqrt(X * X + Y * Y + Z * Z), U.Length);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_LengthFast()
|
||||
{
|
||||
float X = 1, Y = 2, Z = 2;
|
||||
Vector3 U = new Vector3(X, Y, Z);
|
||||
Assert.AreEqual(1.0f / MathHelper.InverseSqrtFast(X * X + Y * Y + Z * Z), U.LengthFast);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Normalized()
|
||||
{
|
||||
float X = 2, Y = 4, Z = 16;
|
||||
Vector3 U = new Vector3(X, Y, Z);
|
||||
float length = U.Length;
|
||||
Vector3 V = U.Normalized();
|
||||
Assert.AreEqual(U.X / length, V.X);
|
||||
Assert.AreEqual(U.Y / length, V.Y);
|
||||
Assert.AreEqual(U.Z / length, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_NormalizeFast_Instance()
|
||||
{
|
||||
float X = 2, Y = 4, Z = 16;
|
||||
Vector3 U = new Vector3(X, Y, Z);
|
||||
Vector3 V = U;
|
||||
V.NormalizeFast();
|
||||
float scale = MathHelper.InverseSqrtFast(X * X + Y * Y + Z * Z);
|
||||
Assert.AreEqual(U.X * scale, V.X);
|
||||
Assert.AreEqual(U.Y * scale, V.Y);
|
||||
Assert.AreEqual(U.Z * scale, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Add()
|
||||
{
|
||||
Vector3 T = new Vector3(7, 8, 9);
|
||||
Vector3 U = new Vector3(23, 89, -34);
|
||||
Vector3 V = Vector3.Add(T, U);
|
||||
Assert.AreEqual(T.X + U.X, V.X);
|
||||
Assert.AreEqual(T.Y + U.Y, V.Y);
|
||||
Assert.AreEqual(T.Z + U.Z, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Subtract()
|
||||
{
|
||||
Vector3 T = new Vector3(7, 8, 9);
|
||||
Vector3 U = new Vector3(23, 89, -34);
|
||||
Vector3 V = Vector3.Subtract(T, U);
|
||||
Assert.AreEqual(T.X - U.X, V.X);
|
||||
Assert.AreEqual(T.Y - U.Y, V.Y);
|
||||
Assert.AreEqual(T.Z - U.Z, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Multiply_Scalar()
|
||||
{
|
||||
float scalar = 5.5f;
|
||||
Vector3 U = new Vector3(23, 89, -34);
|
||||
Vector3 V = Vector3.Multiply(U, scalar);
|
||||
Assert.AreEqual(U.X * scalar, V.X);
|
||||
Assert.AreEqual(U.Y * scalar, V.Y);
|
||||
Assert.AreEqual(U.Z * scalar, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Multiply_Componentwise()
|
||||
{
|
||||
Vector3 T = new Vector3(7, 8, 0.5f);
|
||||
Vector3 U = new Vector3(23, 89, -34);
|
||||
Vector3 V = Vector3.Multiply(T, U);
|
||||
Assert.AreEqual(T.X * U.X, V.X);
|
||||
Assert.AreEqual(T.Y * U.Y, V.Y);
|
||||
Assert.AreEqual(T.Z * U.Z, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Divide_Scalar()
|
||||
{
|
||||
float scalar = 5.5f;
|
||||
Vector3 U = new Vector3(23, 89, -34);
|
||||
Vector3 V = Vector3.Divide(U, scalar);
|
||||
//we have to account for a small amount of round off error
|
||||
//in this division test
|
||||
Assert.IsTrue(Math.Abs((U.X / scalar) - V.X) < 1e-5);
|
||||
Assert.IsTrue(Math.Abs((U.Y / scalar) - V.Y) < 1e-5);
|
||||
Assert.IsTrue(Math.Abs((U.Z / scalar) - V.Z) < 1e-5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_ComponentMin()
|
||||
{
|
||||
Vector3 T = new Vector3(1, 55, -100);
|
||||
Vector3 U = new Vector3(24, 3, 1);
|
||||
Vector3 V = Vector3.ComponentMin(T, U);
|
||||
Assert.AreEqual(1, V.X);
|
||||
Assert.AreEqual(3, V.Y);
|
||||
Assert.AreEqual(-100, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_ComponentMinOut()
|
||||
{
|
||||
Vector3 T = new Vector3(1, 55, -100);
|
||||
Vector3 U = new Vector3(24, 3, 1);
|
||||
Vector3 V;
|
||||
Vector3.ComponentMin(ref T, ref U, out V);
|
||||
Assert.AreEqual(1, V.X);
|
||||
Assert.AreEqual(3, V.Y);
|
||||
Assert.AreEqual(-100, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_ComponentMax()
|
||||
{
|
||||
Vector3 T = new Vector3(1, 55, -100);
|
||||
Vector3 U = new Vector3(24, 3, 1);
|
||||
Vector3 V = Vector3.ComponentMax(T, U);
|
||||
Assert.AreEqual(24, V.X);
|
||||
Assert.AreEqual(55, V.Y);
|
||||
Assert.AreEqual(1, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_ComponentMaxOut()
|
||||
{
|
||||
Vector3 T = new Vector3(1, 55, -100);
|
||||
Vector3 U = new Vector3(24, 3, 1);
|
||||
Vector3 V;
|
||||
Vector3.ComponentMax(ref T, ref U, out V);
|
||||
Assert.AreEqual(24, V.X);
|
||||
Assert.AreEqual(55, V.Y);
|
||||
Assert.AreEqual(1, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Min()
|
||||
{
|
||||
Vector3 T = new Vector3(1, 2, 3);
|
||||
Vector3 U = new Vector3(24, 300, 88);
|
||||
Vector3 result = Vector3.Min(T, U);
|
||||
Assert.IsTrue(result == T);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Max()
|
||||
{
|
||||
Vector3 T = new Vector3(1, 2, 3);
|
||||
Vector3 U = new Vector3(24, 300, 88);
|
||||
Vector3 result = Vector3.Max(T, U);
|
||||
Assert.IsTrue(result == U);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Clamp()
|
||||
{
|
||||
Vector3 V = new Vector3(-6, 302, -22);
|
||||
Vector3 min = new Vector3(-5, -10, -20);
|
||||
Vector3 max = new Vector3(24, 300, 55);
|
||||
Vector3 result = Vector3.Clamp(V, min, max);
|
||||
Assert.AreEqual(result.X, -5);
|
||||
Assert.AreEqual(result.Y, 300);
|
||||
Assert.AreEqual(result.Z, -20);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_ClampOut()
|
||||
{
|
||||
Vector3 V = new Vector3(-6, 302, -22);
|
||||
Vector3 min = new Vector3(-5, -10, -20);
|
||||
Vector3 max = new Vector3(24, 300, 55);
|
||||
Vector3 result;
|
||||
Vector3.Clamp(ref V, ref min, ref max, out result);
|
||||
Assert.AreEqual(result.X, -5);
|
||||
Assert.AreEqual(result.Y, 300);
|
||||
Assert.AreEqual(result.Z, -20);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Normalize()
|
||||
{
|
||||
float X = 64, Y = 144, Z = 16;
|
||||
Vector3 U = new Vector3(X, Y, Z);
|
||||
Vector3 V = Vector3.Normalize(U);
|
||||
float length = U.Length;
|
||||
Assert.IsTrue(Math.Abs((U.X / length) - V.X) < 1e-5);
|
||||
Assert.IsTrue(Math.Abs((U.Y / length) - V.Y) < 1e-5);
|
||||
Assert.IsTrue(Math.Abs((U.Z / length) - V.Z) < 1e-5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_NormalizeOut()
|
||||
{
|
||||
float X = 64, Y = 144, Z = 16;
|
||||
Vector3 U = new Vector3(X, Y, Z);
|
||||
Vector3 V;
|
||||
Vector3.Normalize(ref U, out V);
|
||||
float length = U.Length;
|
||||
Assert.IsTrue(Math.Abs((U.X / length) - V.X) < 1e-5);
|
||||
Assert.IsTrue(Math.Abs((U.Y / length) - V.Y) < 1e-5);
|
||||
Assert.IsTrue(Math.Abs((U.Z / length) - V.Z) < 1e-5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_NormalizeFast_Static()
|
||||
{
|
||||
float X = 64, Y = 144, Z = 16;
|
||||
Vector3 U = new Vector3(X, Y, Z);
|
||||
Vector3 V = Vector3.NormalizeFast(U);
|
||||
float scale = MathHelper.InverseSqrtFast(X * X + Y * Y + Z * Z);
|
||||
Assert.AreEqual(U.X * scale, V.X);
|
||||
Assert.AreEqual(U.Y * scale, V.Y);
|
||||
Assert.AreEqual(U.Z * scale, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_NormalizeFast()
|
||||
{
|
||||
float X = 64, Y = 144, Z = 16;
|
||||
Vector3 U = new Vector3(X, Y, Z);
|
||||
Vector3 V;
|
||||
Vector3.NormalizeFast(ref U, out V);
|
||||
float scale = MathHelper.InverseSqrtFast(X * X + Y * Y + Z * Z);
|
||||
Assert.AreEqual(U.X * scale, V.X);
|
||||
Assert.AreEqual(U.Y * scale, V.Y);
|
||||
Assert.AreEqual(U.Z * scale, V.Z);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Dot()
|
||||
{
|
||||
Vector3 T = new Vector3(7, 8, 9);
|
||||
Vector3 U = new Vector3(23, 89, -34);
|
||||
float dot = Vector3.Dot(T, U);
|
||||
float expected = T.X * U.X + T.Y * U.Y + T.Z * U.Z;
|
||||
Assert.AreEqual(expected, dot);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Cross()
|
||||
{
|
||||
Vector3 T = new Vector3(7, 8, 9);
|
||||
Vector3 U = new Vector3(23, 89, -34);
|
||||
Vector3 expected = new Vector3(-1073, 445, 439);
|
||||
Vector3 result = Vector3.Cross(T, U);
|
||||
Assert.IsTrue(expected == result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Lerp()
|
||||
{
|
||||
Vector3 T = new Vector3(7, 8, 9);
|
||||
Vector3 U = new Vector3(23, 89, -34);
|
||||
float blend = 0.25f;
|
||||
Vector3 expected = blend * (U - T) + T;
|
||||
Vector3 result = Vector3.Lerp(T, U, blend);
|
||||
Assert.IsTrue(expected == result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_LerpOut()
|
||||
{
|
||||
Vector3 T = new Vector3(7, 8, 9);
|
||||
Vector3 U = new Vector3(23, 89, -34);
|
||||
float blend = 0.25f;
|
||||
Vector3 expected = blend * (U - T) + T;
|
||||
Vector3 result;
|
||||
Vector3.Lerp(ref T, ref U, blend, out result);
|
||||
Assert.IsTrue(expected == result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_BaryCentric()
|
||||
{
|
||||
Vector3 a = new Vector3(7, 8, 9);
|
||||
Vector3 b = new Vector3(23, 89, -34);
|
||||
Vector3 c = new Vector3(88, -42, 39);
|
||||
float u = 0.25f;
|
||||
float v = 0.75f;
|
||||
Vector3 expected = a + u * (b - a) + v * (c - a);
|
||||
Vector3 result = Vector3.BaryCentric(a, b, c, u, v);
|
||||
Assert.IsTrue(expected == result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_BaryCentricOut()
|
||||
{
|
||||
Vector3 a = new Vector3(7, 8, 9);
|
||||
Vector3 b = new Vector3(23, 89, -34);
|
||||
Vector3 c = new Vector3(88, -42, 39);
|
||||
float u = 0.25f;
|
||||
float v = 0.75f;
|
||||
Vector3 expected = a + u * (b - a) + v * (c - a);
|
||||
Vector3 result;
|
||||
Vector3.BaryCentric(ref a, ref b, ref c, u, v, out result);
|
||||
Assert.IsTrue(expected == result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Matrix3TimesVector3_operator()
|
||||
{
|
||||
Matrix3 A = new Matrix3();
|
||||
A[0, 0] = 16; A[0, 1] = 15; A[0, 2] = 14;
|
||||
A[1, 0] = 12; A[1, 1] = 11; A[1, 2] = 10;
|
||||
A[2, 0] = 8; A[2, 1] = 7; A[2, 2] = 6;
|
||||
|
||||
Vector3 input = new Vector3(1, 5, 9);
|
||||
Vector3 result = A * input;
|
||||
OpenTK.Vector3 expected = new OpenTK.Vector3(217, 157, 97);
|
||||
Assert.IsTrue(expected == result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Vector3_Equal_operator()
|
||||
{
|
||||
Vector3 V = new Vector3(1, 2, 3);
|
||||
Vector3 U = new Vector3(1, 2, 3);
|
||||
Assert.IsTrue(U == V);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
||||
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in a new issue