Example #1
0
def test_2dim_cross():
    """test the cross product of two 2 dimensional vectors"""

    # 2 dim cross-product.
    x = [1, 2]
    y = [4, 5]
    z = tnp.cross(x, y)

    assert z == [-3]
Example #2
0
def test_cross():
    """test the cross product of two 3 dimensional vectors"""

    # Vector cross-product.
    x = [1, 2, 3]
    y = [4, 5, 6]
    z = tnp.cross(x, y)

    assert z == [-3, 6, -3]
Example #3
0
def test_2dim_cross():
    """test the cross product of two 2 dimensional vectors"""

    # 2 dim cross-product.
    x = [1, 2]
    y = [4, 5]
    z = tnp.cross(x, y)

    assert z == [-3]
Example #4
0
def test_cross():
    """test the cross product of two 3 dimensional vectors"""

    # Vector cross-product.
    x = [1, 2, 3]
    y = [4, 5, 6]
    z = tnp.cross(x, y)

    assert z == [-3, 6, -3]
Example #5
0
def test_mdim_cross():
    """test the cross product of two 4 dimensional vectors"""

    # Mixed dim cross-product.
    x = [1, 2, 3]
    y = [4, 5, 6, 7]

    with pytest.raises(IndexError) as execinfo:
        z = tnp.cross(x, y)

    assert 'Vector has invalid dimensions' in str(execinfo.value)
Example #6
0
def test_mdim_cross():
    """test the cross product of two 4 dimensional vectors"""

    # Mixed dim cross-product.
    x = [1, 2, 3]
    y = [4, 5, 6, 7]

    with pytest.raises(IndexError) as execinfo:
        z = tnp.cross(x, y)

    assert 'Vector has invalid dimensions' in str(execinfo.value)