test
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"displayName": "Exercise 4: Solution",
|
||||
"description": "This exercise will cover the custom equality comparers included in UTF, such as Vector3EqualityComparer. These are used to assert on e.g. Vectors.",
|
||||
"interactiveImport": true
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33eb7b56a856011439599af3c79cc98d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "MyExercise_4s"
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 726b3981c4e0a1a47a37e127ce563af0
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace MyExercise_4s
|
||||
{
|
||||
public class ValueOutputter
|
||||
{
|
||||
public Vector3 GetVector3()
|
||||
{
|
||||
return new Vector3(10f + (1f/3f), 3f, 9f + (2f/3f));
|
||||
}
|
||||
|
||||
public Quaternion GetQuaternion()
|
||||
{
|
||||
return new Quaternion(10f, 0f, 7f + (1f/3f), 0f);
|
||||
}
|
||||
|
||||
public float GetFloat()
|
||||
{
|
||||
return 19f + (1f/3f);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebca44b3dc63bcc40997c8afb214c07b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79868b35df78aaa4db2300c8e2f9bd8b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "Tests_4s",
|
||||
"references": [
|
||||
"UnityEngine.TestRunner",
|
||||
"UnityEditor.TestRunner",
|
||||
"MyExercise_4s"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": true,
|
||||
"precompiledReferences": [
|
||||
"nunit.framework.dll"
|
||||
],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"UNITY_INCLUDE_TESTS"
|
||||
],
|
||||
"versionDefines": []
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea6e06f837ff8c141aaabf0b1a7588b4
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,42 @@
|
||||
using MyExercise_4s;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools.Utils;
|
||||
|
||||
namespace Tests_4s
|
||||
{
|
||||
internal class ValueOutputterTests
|
||||
{
|
||||
[Test]
|
||||
public void Vector3ReturnsCorrectValue()
|
||||
{
|
||||
var valueOutputterUnderTest = new ValueOutputter();
|
||||
|
||||
var vector3 = valueOutputterUnderTest.GetVector3();
|
||||
|
||||
var expected = new Vector3(10.333f, 3f, 9.666f);
|
||||
Assert.That(vector3, Is.EqualTo(expected).Using(new Vector3EqualityComparer(0.001f)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FloatReturnsCorrectValue()
|
||||
{
|
||||
var valueOutputterUnderTest = new ValueOutputter();
|
||||
|
||||
var actualFloat = valueOutputterUnderTest.GetFloat();
|
||||
|
||||
Assert.That(actualFloat, Is.EqualTo(19.333f).Using(new FloatEqualityComparer(0.001f)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void QuaternionReturnsCorrectValue()
|
||||
{
|
||||
var valueOutputterUnderTest = new ValueOutputter();
|
||||
|
||||
var actualValue = valueOutputterUnderTest.GetQuaternion();
|
||||
|
||||
var expectedValue = new Quaternion(10f, 0f, 7.33333f, 0f);
|
||||
Assert.That(actualValue, Is.EqualTo(expectedValue).Using(new QuaternionEqualityComparer(0.001f)));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f79b0fe29be970a4b96a4f9df9d34fdc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user