Skip to content

Commit d835006

Browse files
committed
add unit tests
1 parent e6b2f9b commit d835006

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// NOTE: uncomment the next line to leave temporary FBX files on disk
2+
// and create a imported object in the scene.
3+
//#define DEBUG_UNITTEST
4+
5+
using UnityEngine;
6+
using UnityEditor;
7+
using NUnit.Framework;
8+
using System.Collections.Generic;
9+
using System.Collections;
10+
using FbxExporters.CustomExtensions;
11+
12+
namespace FbxExporters.UnitTests
13+
{
14+
public class CustomExtensionsTest : ExporterTestBase
15+
{
16+
private float Value1 { get { return 1f; } }
17+
18+
[TearDown]
19+
public override void Term ()
20+
{
21+
#if (!DEBUG_UNITTEST)
22+
base.Term ();
23+
#endif
24+
}
25+
26+
[Test]
27+
public void MetricDistanceTest()
28+
{
29+
Assert.That(Value1.Meters().ToCentimeters(), Is.EqualTo(100f));
30+
31+
Assert.That(1f.Meters(), Is.EqualTo(100f.Centimeters()));
32+
Assert.That(10f.Millimeters().ToMeters(), Is.EqualTo(1f.Centimeters().ToMeters()).Within(0.00001f));
33+
Assert.That(1f.Centimeters().ToMeters(), Is.EqualTo(10f.Millimeters().ToMeters()).Within(0.00001f));
34+
Assert.That(0.0254f.Meters(), Is.EqualTo(1f.Inches().ToMetric()));
35+
Assert.That(1f.Meters().ToImperial(), Is.EqualTo(39.3701f.Inches()));
36+
}
37+
}
38+
}

Assets/com.unity.formats.fbx.tests/CustomExtensionsTest.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)