test_harness.alc 739 B

123456789101112131415161718192021222324252627282930313233
  1. include "primitives.alh"
  2. include "jit.alh"
  3. Void function test_main()
  4. Void function call_function(function_name : String):
  5. // Resolve the specified function, and execute it.
  6. Element func
  7. func = resolve(function_name)
  8. func()
  9. return!
  10. Void function main():
  11. String config
  12. Integer start_time
  13. Integer end_time
  14. config = input()
  15. // if (config == "interpreter"):
  16. // set_jit_enabled(False)
  17. start_time = time()
  18. // HACK: use `call_function` to hide what would otherwise be a direct call to `test_main`
  19. // from the JIT. This prevents the JIT from compiling `test_main` _before_ `config` has
  20. // been analyzed.
  21. call_function("test_main")
  22. end_time = time()
  23. output(end_time - start_time)
  24. while (True):
  25. output(input())
  26. return!