tsemfold.nim 937 B

12345678910111213141516171819202122232425262728
  1. discard """
  2. action: run
  3. """
  4. doAssertRaises(OverflowDefect): discard low(int8) - 1'i8
  5. doAssertRaises(OverflowDefect): discard high(int8) + 1'i8
  6. doAssertRaises(OverflowDefect): discard abs(low(int8))
  7. doAssertRaises(DivByZeroDefect): discard 1 mod 0
  8. doAssertRaises(DivByZeroDefect): discard 1 div 0
  9. doAssertRaises(OverflowDefect): discard low(int8) div -1'i8
  10. doAssertRaises(OverflowDefect): discard -low(int64)
  11. doAssertRaises(OverflowDefect): discard low(int64) - 1'i64
  12. doAssertRaises(OverflowDefect): discard high(int64) + 1'i64
  13. type E = enum eA, eB
  14. doAssertRaises(OverflowDefect): discard eA.pred
  15. doAssertRaises(OverflowDefect): discard eB.succ
  16. doAssertRaises(OverflowDefect): discard low(int8) * -1
  17. doAssertRaises(OverflowDefect): discard low(int64) * -1
  18. doAssertRaises(OverflowDefect): discard high(int8) * 2
  19. doAssertRaises(OverflowDefect): discard high(int64) * 2
  20. doAssert abs(-1) == 1
  21. doAssert 2 div 2 == 1
  22. doAssert 2 * 3 == 6