test_version.mod 999 B

1234567891011121314151617181920212223242526272829303132
  1. MODULE test_version ;
  2. (*
  3. m2SDL3 smoke test: SDL_GetVersion returns 3.x.y as an int
  4. version number (major*1000000+minor*1000+micro); the
  5. SDL3Utils decode helpers must agree with DIV/MOD arithmetic.
  6. *)
  7. FROM SDL3Version IMPORT SDL_GetVersion, SDL_GetRevision,
  8. SDLCompiledMajor, SDLCompiledMinor, SDLCompiledMicro;
  9. FROM SDL3Utils IMPORT VersionMajor, VersionMinor, VersionMicro;
  10. FROM libc IMPORT printf;
  11. VAR v: INTEGER;
  12. BEGIN
  13. v := SDL_GetVersion();
  14. printf("version %d.%d.%d (%d)\n",
  15. VersionMajor(v), VersionMinor(v), VersionMicro(v), v);
  16. printf("revision %s\n", SDL_GetRevision());
  17. IF VersionMajor(v) # 3 THEN
  18. printf("FAIL test_version: expected major 3\n");
  19. HALT(1)
  20. END;
  21. IF (VersionMajor(v) # SDLCompiledMajor)
  22. OR (VersionMinor(v) # SDLCompiledMinor)
  23. OR (VersionMicro(v) # SDLCompiledMicro) THEN
  24. printf("FAIL test_version: linked != compiled headers\n");
  25. HALT(1)
  26. END;
  27. printf("PASS test_version\n")
  28. END test_version.