tfloat7.nim 489 B

12345678910111213141516171819202122232425262728
  1. discard """
  2. output: '''
  3. passed.
  4. passed.
  5. passed.
  6. passed.
  7. passed.
  8. passed.
  9. passed.
  10. '''
  11. """
  12. import strutils
  13. template expect_fail(x) =
  14. try:
  15. discard x
  16. echo("expected to fail!")
  17. except ValueError:
  18. echo("passed.")
  19. expect_fail("1_0._00_0001".parseFloat())
  20. expect_fail("_1_0_00.0001".parseFloat())
  21. expect_fail("10.00.01".parseFloat())
  22. expect_fail("10.00E_01".parseFloat())
  23. expect_fail("10.00E_01".parseFloat())
  24. expect_fail("10.00E".parseFloat())
  25. expect_fail("10.00A".parseFloat())