Example #1
0
        public void Abs_V2ReturnsCorrectly()
        {
            //  arrange
            Vector2 v        = new Vector2(-3, 1);
            Vector2 expected = new Vector2(
                Mathf.Abs(v.x), Mathf.Abs(v.y));

            //  act
            v = PMath.Abs(v);

            //  assert
            Assert.AreEqual(expected, v);
            Assert.AreEqual(expected.x, v.x);
            Assert.AreEqual(expected.y, v.y);
        }
Example #2
0
        public void Abs_V3ReturnsCorrectly()
        {
            //  arrange
            Vector3 v        = new Vector3(-3, 1, -8);
            Vector3 expected = new Vector3(
                Mathf.Abs(v.x),
                Mathf.Abs(v.y),
                Mathf.Abs(v.z));

            //  act
            v = PMath.Abs(v);

            //  assert
            Assert.AreEqual(expected.x, v.x);
            Assert.AreEqual(expected.y, v.y);
            Assert.AreEqual(expected.z, v.z);
        }