Skip to content

Commit

Permalink
added enum to int tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Mar 28, 2024
1 parent 78e591d commit a997f7f
Showing 1 changed file with 48 additions and 5 deletions.
53 changes: 48 additions & 5 deletions tests/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ def test_ulong_enum():
assert Test.ULongEnum.Two == Test.ULongEnum(2)


def test_simple_enum_to_int():
from System import DayOfWeek
assert int(DayOfWeek.Sunday) == 0


def test_long_enum_to_int():
assert int(Test.LongEnum.Max) == 9223372036854775807
assert int(Test.LongEnum.Min) == -9223372036854775808
Expand Down Expand Up @@ -178,6 +173,54 @@ def test_enum_conversion():
Test.FieldTest().EnumField = 1


def test_byte_enum_to_int():
"""Test byte enum to int"""
assert bool(Test.ByteEnum.Zero) == 0
assert bool(Test.ByteEnum.One) == 1


def test_sbyte_enum_to_int():
"""Test sbyte enum to int"""
assert bool(Test.SByteEnum.Zero) == 0
assert bool(Test.SByteEnum.One) == 1


def test_short_enum_to_int():
"""Test short enum to int"""
assert bool(Test.ShortEnum.Zero) == 0
assert bool(Test.ShortEnum.One) == 1


def test_ushort_enum_to_int():
"""Test ushort enum to int"""
assert bool(Test.UShortEnum.Zero) == 0
assert bool(Test.UShortEnum.One) == 1


def test_int_enum_to_int():
"""Test int enum to int"""
assert bool(Test.IntEnum.Zero) == 0
assert bool(Test.IntEnum.One) == 1


def test_uint_enum_to_int():
"""Test uint enum to int"""
assert bool(Test.UIntEnum.Zero) == 0
assert bool(Test.UIntEnum.One) == 1


def test_long_enum_to_int():
"""Test long enum to int"""
assert bool(Test.LongEnum.Zero) == 0
assert bool(Test.LongEnum.One) == 1


def test_ulong_enum_to_int():
"""Test ulong enum to int"""
assert bool(Test.ULongEnum.Zero) == 0
assert bool(Test.ULongEnum.One) == 1


def test_byte_enum_to_bool():
"""Test byte enum to bool"""
assert bool(Test.ByteEnum.Zero) == False
Expand Down

0 comments on commit a997f7f

Please sign in to comment.