using UnityEngine; using NUnit.Framework; namespace MLAgents.Tests { public class RayPerceptionTests : MonoBehaviour { [Test] public void TestPerception3D() { var angles = new[] {0f, 90f, 180f}; var tags = new[] {"test", "test_1"}; var go = new GameObject("MyGameObject"); var rayPer3D = go.AddComponent(); var result = rayPer3D.Perceive(1f, angles, tags); Assert.IsTrue(result.Count == angles.Length * (tags.Length + 2)); } [Test] public void TestPerception2D() { var angles = new[] {0f, 90f, 180f}; var tags = new[] {"test", "test_1"}; var go = new GameObject("MyGameObject"); var rayPer2D = go.AddComponent(); var result = rayPer2D.Perceive(1f, angles, tags); Assert.IsTrue(result.Count == angles.Length * (tags.Length + 2)); } [Test] public void TestConstants() { Assert.AreEqual(Physics.DefaultRaycastLayers, Physics2D.DefaultRaycastLayers); } } }