[RISCV] Add RVVConstraint to SiFive custom matrix multiply instructions. (#124055)
[llvm-project.git] / clang / bindings / python / tests / cindex / test_enums.py
blob9e7f44fcf7867c71a9ad69c0711849bcf842c3c6
1 import unittest
3 from clang.cindex import (
4 AccessSpecifier,
5 AvailabilityKind,
6 BinaryOperator,
7 CursorKind,
8 ExceptionSpecificationKind,
9 LinkageKind,
10 RefQualifierKind,
11 StorageClass,
12 TemplateArgumentKind,
13 TLSKind,
14 TokenKind,
15 TypeKind,
19 class TestEnums(unittest.TestCase):
20 enums = [
21 TokenKind,
22 CursorKind,
23 TemplateArgumentKind,
24 ExceptionSpecificationKind,
25 AvailabilityKind,
26 AccessSpecifier,
27 TypeKind,
28 RefQualifierKind,
29 LinkageKind,
30 TLSKind,
31 StorageClass,
32 BinaryOperator,
35 def test_from_id(self):
36 """Check that kinds can be constructed from valid IDs"""
37 for enum in self.enums:
38 self.assertEqual(enum.from_id(2), enum(2))
39 max_value = max([variant.value for variant in enum])
40 with self.assertRaises(ValueError):
41 enum.from_id(max_value + 1)
42 with self.assertRaises(ValueError):
43 enum.from_id(-1)
45 def test_duplicate_ids(self):
46 """Check that no two kinds have the same id"""
47 # for enum in self.enums:
48 for enum in self.enums:
49 num_declared_variants = len(enum._member_map_.keys())
50 num_unique_variants = len(list(enum))
51 self.assertEqual(num_declared_variants, num_unique_variants)