Ejemplo n.º 1
0
 def test_bitflags_really_are_bitflags(self):
   a = nark.Assert()
   i = nark.bitflags("ONE", "TWO", "THREE", "FOUR")
   value1 = i.ONE | i.TWO
   value2 = i.TWO | i.THREE | i.FOUR
   a.true(value1 & i.ONE, "Bitflags don't merge correctly (&)")
   a.false(value1 & i.THREE, "Bitflags don't merge correctly (!&)")
   a.false(value2 & i.THREE & i.FOUR, "Bitflags don't merge correctly (&&)")
   a.true(value2 & (i.THREE | i.FOUR), "Bitflags don't merge correctly (&|)")
Ejemplo n.º 2
0
 def test_can_create_bitflags(self):
   a = nark.Assert()
   i = nark.bitflags("ONE", "TWO")
   a.not_null(i, "Enum instance returned null")
   a.not_equal(i.ONE, i.TWO, "Enum values are not unique")