Commits

Armin Rigo committed 0b2a781

Copy here from backend_tests

  • Participants
  • Parent commits c0ca0cf

Comments (0)

Files changed (1)

     assert repr(cast(BEnum, '#-20')) == "<cdata 'enum foo' 'ab'>"
     assert repr(cast(BEnum, '#-21')) == "<cdata 'enum foo' '#-21'>"
 
+def test_enum_with_non_injective_mapping():
+    BEnum = new_enum_type("foo", ('ab', 'cd'), (7, 7))
+    e = cast(BEnum, 7)
+    assert repr(e) == "<cdata 'enum foo' 'ab'>"
+    assert string(e) == 'ab'
+
 def test_enum_in_struct():
     BEnum = new_enum_type("foo", ('def', 'c', 'ab'), (0, 1, -20))
     BStruct = new_struct_type("bar")