My favorites
▼
|
Sign in
dogfight2008
A casual head-to-head airplane action game for two human players.
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
src
/
Dogfight2008.Common.Tests
/
CalcFixture.cs
r6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using OpenTK.Math;
namespace Dogfight2008.Common.Tests
{
[TestFixture]
public class CalcFixture
{
[Test]
public void Equal_Vector3()
{
Assert.IsTrue(Calc.Equal(Vector3.UnitZ, Vector3.UnitZ));
}
[Test]
public void NotEqual_Vector3()
{
Assert.IsFalse(Calc.Equal(Vector3.UnitZ, Vector3.UnitX));
}
[Test]
public void AlmostEqual_Vector3()
{
Vector3 v2 = Vector3.UnitZ;
v2.X += 0.0000001f;
Assert.IsTrue(Calc.AlmostEqual(Vector3.UnitZ, v2));
}
[Test]
public void AlmostEqual_Vector3_2()
{
Assert.IsFalse(Calc.Equal(Vector3.UnitZ, Vector3.UnitX));
}
[Test]
public void AlmostEqualFloat()
{
Assert.IsTrue(Calc.AlmostEqual(1, 1.0000001f));
}
[Test]
public void AlmostEqualFloat2()
{
Assert.IsFalse(Calc.AlmostEqual(1, 2));
}
[Test]
public void Polar()
{
double angle = Calc.DegreesToRadians(30);
Vector2 v = Calc.Polar(angle, 10);
Vector2 exp = Calc.v(Math.Cos(angle) * 10, Math.Sin(angle) * 10);
Assert.AreEqual(exp.X, v.X);
Assert.AreEqual(exp.Y, v.Y);
}
[Test]
public void D2R()
{
Assert.AreEqual(0, Calc.DegreesToRadians(0), 0.01f);
Assert.AreEqual(Math.PI, Calc.DegreesToRadians(180), 0.01f);
}
}
}
Show details
Hide details
Change log
r5
by olof.bjarnason on Jun 12, 2008
Diff
[No log message]
Go to:
...nk/src/Dogfight2008.Common.Tests
...2008.Common.Tests/CalcFixture.cs
...n.Tests/ColoredPolygonFixture.cs
...sts/ColoredPolygonMeshFixture.cs
....Tests/ColoredTriangleFixture.cs
...ts/ColoredTriangleSoupFixture.cs
...Common.Tests/CplLoaderFixture.cs
...mmon.Tests/CubeCreatorFixture.cs
...Dogfight2008.Common.Tests.csproj
...Common.Tests/FixedListFixture.cs
...Common.Tests/PlyLoaderFixture.cs
...ight2008.Common.Tests/Properties
...Tests/Properties/AssemblyInfo.cs
...ght2008.Common.Tests/QFixture.cs
....Common.Tests/TriangleFixture.cs
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1487 bytes, 67 lines
View raw file
Powered by
Google Project Hosting