Esempio n. 1
0
 def test_add(self):
     for v1, v2 in itertools.product(utils.ALL_VECTORS, utils.ALL_VECTORS):
         utils.assert_vectors_almost_equal(v1 + v2, vector_ops.add(v1, v2))
Esempio n. 2
0
 def test_add_associative(self):
     for v1, v2 in itertools.product(utils.ALL_VECTORS, utils.ALL_VECTORS):
         for v3 in utils.ALL_VECTORS:
             vec1 = vector_ops.add(vector_ops.add(v1, v2), v3)
             vec2 = vector_ops.add(v1, vector_ops.add(v2, v3))
             utils.assert_vectors_almost_equal(vec1, vec2)
Esempio n. 3
0
 def test_subtract(self):
     for v1, v2 in itertools.product(utils.ALL_VECTORS, utils.ALL_VECTORS):
         utils.assert_vectors_almost_equal(vector_ops.subtract(v1, v2),
                                           vector_ops.add(v1, -v2))
Esempio n. 4
0
 def test_add_commutative(self):
     for v1, v2 in itertools.product(utils.ALL_VECTORS, utils.ALL_VECTORS):
         vec1 = vector_ops.add(v1, v2)
         vec2 = vector_ops.add(v2, v1)
         utils.assert_vectors_almost_equal(vec1, vec2)