Skip to content

Commit

Permalink
Add some tests for aberrant unsigned values
Browse files Browse the repository at this point in the history
  • Loading branch information
mossprescott committed Apr 22, 2024
1 parent 3f42e5c commit 8d4a79c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test_02.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ def test_neg16(run=run("vector")):
assert run(Neg16, in_= -1).out == True
assert run(Neg16, in_= -32768).out == True

# If a 16-bit "unsigned" value somehow sneaks in, it should be treated as negative:
assert run(Neg16, in_= 32768).out == True
assert run(Neg16, in_= 54605).out == True
assert run(Neg16, in_= 65535).out == True

# On the other hand, a 17-bit value wraps to positive:
assert run(Neg16, in_= -65536).out == False


def test_alu_nostat(run=run("vector")):
alu = run(ALU)

Expand Down

0 comments on commit 8d4a79c

Please sign in to comment.