def test_createSpread(self): start = [0, 0, 0] spread = S.createSpread(start) self.assertTrue(len(spread) > 4) likeStart = 0 for s in spread: if s == start: likeStart += 1 else: self.assertNotEqual(s, start) self.assertNotEqual(S.totalDistance(s), 0) self.assertEqual(likeStart, 1)
def test_totalDistance(self): self.assertEqual(S.totalDistance([1, 1, 1]), 3) self.assertTrue(S.equalish(S.totalDistance([1, 2, 3]), 0.45))