Exemplo n.º 1
0
        public void ImpactForceInNewtons_ReturnsCorrectValue()
        {
            //  prereq
            Approx_Works();

            //  arrange
            float mass      = 10;    //  kg
            float speed     = 50;    //  m/s
            float lossRatio = 0.5f;  //  50% speed energy loss
            float deltaTime = 1f / 60;

            //  act
            float force    = PMath.ImpactForceInNewtons(mass, speed, lossRatio, deltaTime);
            float expected = mass * speed * lossRatio / deltaTime;

            //  assert
            Assert.IsTrue(PMath.Approx(expected, force), TestHelper.ShowVariables(expected, force));
        }