def test_linear_interp3(self): '''c = 0, m = 1''' m = -23 c = -234.234 x1 = -234.34 x2 = -23.9 y1 = x1 * m + c y2 = x2 * m + c testx = 17.3 testy = testx * m + c calculatedy = sa.linear_interp(x1, y1, x2, y2, testx) self.assertAlmostEqual(testy, calculatedy, places=3)
def test_linear_interp2(self): '''c = 0, m = 1''' m = 2 c = 3 x1 = 3 x2 = 5 y1 = x1 * m + c y2 = x2 * m + c testx = 2 testy = testx * m + c calculatedy = sa.linear_interp(x1, y1, x2, y2, testx) self.assertEqual(testy, calculatedy)
def test_linear_interp1(self): '''c = 0, m = 1''' m = 1 c = 0 x1 = 1 x2 = 2 y1 = x1 * m + c y2 = x2 * m + c testx = 3 testy = testx * m + c calculatedy = sa.linear_interp(x1, y1, x2, y2, testx) self.assertEqual(testy, calculatedy)
def test_linear_interp3(self): '''c = 0, m = 1''' m = -23 c = -234.234 x1 = -234.34 x2 = -23.9 y1 = x1 * m + c y2 = x2 * m + c testx = 17.3 testy = testx * m + c calculatedy = sa.linear_interp(x1, y1, x2, y2, testx) self.assertAlmostEqual(testy, calculatedy, places = 3)