framework/replay: disable AA accounting when comparing with no tolerance
[piglit.git] / unittests / generators / test_types.py
blobc713d2ffe50e4d3701d28634b372a397e8bb0166
1 # encoding=utf-8
2 # Copyright © 2016, 2019 Intel Corporation
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
5 # of this software and associated documentation files (the "Software"), to deal
6 # in the Software without restriction, including without limitation the rights
7 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 # copies of the Software, and to permit persons to whom the Software is
9 # furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice shall be included in
12 # all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 # SOFTWARE.
22 """Tests from generated_tests/modules/types.py"""
24 import itertools
26 import pytest
28 # pylint can't figure out the sys.path manipulation.
29 from generated_tests.modules import types # pylint: disable=import-error,wrong-import-order
32 def test_container_is_type_assert():
33 """modules.types.Container: Only accept one of is_scalar or
34 is_vector or is_matrix"""
35 for s, v, m in itertools.product([True, False], repeat=3):
36 # Don't test the valid case
37 if [s, v, m].count(True) == 0:
38 continue
40 with pytest.raises(AssertionError):
41 types.Container('foo', is_scalar=s, is_vector=v, is_matrix=m,
42 contains=types.FLOAT)
45 def test_matrix_is_square():
46 """modules.types.Matrix.square: works for square matricies"""
47 for mat in [types.MAT2, types.DMAT3X3]:
48 assert mat.square is True
51 def test_matrix_is_not_square():
52 """modules.types.Matrix.square: works for non-square matricies"""
53 assert types.MAT2X4.square is False
56 def test_type_int_float_assert():
57 """modules.types.Type: only integer or floating can be passed."""
58 with pytest.raises(AssertionError):
59 types.Type('foo', integer=True, floating=True, size=32)
62 def test_type_float_signed_assert():
63 """modules.types.Type: floating types must be signed."""
64 with pytest.raises(AssertionError):
65 types.Type('foo', floating=True, signed=False, size=32)