tsemfold.nim 921 B

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