def test_return_type():

  x = Bits(8)(0b1100)

  Bits1 = Bits(1)
  Bits4 = Bits(4)

  assert isinstance( x.uint(), int  )
  assert isinstance( x.int(),  int  )
  assert isinstance( x[1:2],   Bits1 )
  assert isinstance( x[0:4],   Bits4 )
  assert isinstance( x[2],     Bits1 )
Beispiel #2
0
def test_return_type():

    x = Bits(8)(0b1100)

    Bits1 = Bits(1)
    Bits4 = Bits(4)

    assert isinstance(x.uint(), int)
    assert isinstance(x.int(), int)
    assert isinstance(x[1:2], Bits1)
    assert isinstance(x[0:4], Bits4)
    assert isinstance(x[2], Bits1)
def test_compare_int_neg():

  x = Bits(4)(-2)
  assert x.int() == -2
  assert x.int()  < -1
  assert x.int() <= -1
Beispiel #4
0
def test_compare_int_neg():

    x = Bits(4)(-2)
    assert x.int() == -2
    assert x.int() < -1
    assert x.int() <= -1