tunsignedcmp.nim 586 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. discard """
  2. output: '''true
  3. true
  4. true
  5. 5
  6. 4
  7. 3
  8. 2
  9. 1
  10. 0
  11. it should stop now
  12. 18446744073709551615
  13. 4294967295
  14. '''
  15. """
  16. # bug 1420
  17. var x = 40'u32
  18. var y = 30'u32
  19. echo x > y # works
  20. echo((40'i32) > (30'i32))
  21. echo((40'u32) > (30'u32)) # Error: ordinal type expected
  22. # bug #4220
  23. const count: uint = 5
  24. var stop_me = false
  25. for i in countdown(count, 0):
  26. echo i
  27. if stop_me: break
  28. if i == 0:
  29. echo "it should stop now"
  30. stop_me = true
  31. # bug #3985
  32. const
  33. HIGHEST_64BIT_UINT = 0xFFFFFFFFFFFFFFFF'u
  34. HIGHEST_32BIT_UINT = 0xFFFFFFFF'u
  35. echo($HIGHEST_64BIT_UINT)
  36. echo($HIGHEST_32BIT_UINT)