tvmops.nim 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. discard """
  2. targets: "c cpp js"
  3. """
  4. #[
  5. test for vmops.nim
  6. ]#
  7. import os
  8. import math
  9. import strutils
  10. static:
  11. # TODO: add more tests
  12. block: #getAppFilename, gorgeEx, gorge
  13. const nim = getCurrentCompilerExe()
  14. let ret = gorgeEx(nim & " --version")
  15. doAssert ret.exitCode == 0
  16. doAssert ret.output.contains "Nim Compiler"
  17. let ret2 = gorgeEx(nim & " --nonxistent")
  18. doAssert ret2.exitCode != 0
  19. let output3 = gorge(nim & " --version")
  20. doAssert output3.contains "Nim Compiler"
  21. block:
  22. const key = "D20181210T175037"
  23. const val = "foo"
  24. putEnv(key, val)
  25. doAssert existsEnv(key)
  26. doAssert getEnv(key) == val
  27. block:
  28. # sanity check (we probably don't need to test for all ops)
  29. const a1 = arcsin 0.3
  30. let a2 = arcsin 0.3
  31. doAssert a1 == a2
  32. block bitxor:
  33. let x = -1'i32
  34. let y = 1'i32
  35. doAssert (x xor y) == -2
  36. block:
  37. # Check against bugs like #9176
  38. doAssert getCurrentCompilerExe() == getCurrentCompilerExe().static
  39. if false: #pending #9176
  40. doAssert gorgeEx("nonxistent") == gorgeEx("nonxistent").static