HelpersTest.cs 989 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using AdditionalMathf;
  6. using NUnit.Framework;
  7. using UnityEditor;
  8. using UnityEngine;
  9. using UnityEngine.TestTools;
  10. public class HelpersTest
  11. {
  12. private const float DELTA = 0.05f;
  13. [Test]
  14. public void RemoveOutliersFound()
  15. {
  16. var items = new float[]
  17. {
  18. 1f, 2f, 1.5f, 0.75f, 0.66f, 1.2f, 1.3f, 25f, -10f, 33f
  19. };
  20. var cleaned = Helpers.RemoveOutliers(items).ToList();
  21. Assert.AreEqual(items.Length-3, cleaned.Count);
  22. Assert.False(cleaned.Contains(25f));
  23. Assert.False(cleaned.Contains(-10f));
  24. Assert.False(cleaned.Contains(33f));
  25. }
  26. [Test]
  27. public void RemoveOutliersNothingFound()
  28. {
  29. var items = new float[]
  30. {
  31. 1f, 2f, 1.5f, 0.75f, 0.66f, 1.2f, 1.3f
  32. };
  33. var cleaned = Helpers.RemoveOutliers(items).ToList();
  34. Assert.AreEqual(items, cleaned);
  35. }
  36. }