test_platforms.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --
  2. -- tests/test_platforms.lua
  3. -- Automated test suite for platform handling functions.
  4. -- Copyright (c) 2009 Jason Perkins and the Premake project
  5. --
  6. T.platforms = { }
  7. local testmap = { Native="Win32", x32="Win32", x64="x64" }
  8. local sln, r
  9. function T.platforms.setup()
  10. sln = solution "MySolution"
  11. configurations { "Debug", "Release" }
  12. end
  13. function T.platforms.filter_OnNoSolutionPlatforms()
  14. premake.bake.buildconfigs()
  15. r = premake.filterplatforms(sln, testmap)
  16. test.isequal("", table.concat(r, ":"))
  17. end
  18. function T.platforms.filter_OnNoSolutionPlatformsAndDefault()
  19. premake.bake.buildconfigs()
  20. r = premake.filterplatforms(sln, testmap, "x32")
  21. test.isequal("x32", table.concat(r, ":"))
  22. end
  23. function T.platforms.filter_OnIntersection()
  24. platforms { "x32", "x64", "Xbox360" }
  25. premake.bake.buildconfigs()
  26. r = premake.filterplatforms(sln, testmap, "x32")
  27. test.isequal("x32:x64", table.concat(r, ":"))
  28. end
  29. function T.platforms.filter_OnNoIntersection()
  30. platforms { "Universal", "Xbox360" }
  31. premake.bake.buildconfigs()
  32. r = premake.filterplatforms(sln, testmap)
  33. test.isequal("", table.concat(r, ":"))
  34. end
  35. function T.platforms.filter_OnNoIntersectionAndDefault()
  36. platforms { "Universal", "Xbox360" }
  37. premake.bake.buildconfigs()
  38. r = premake.filterplatforms(sln, testmap, "x32")
  39. test.isequal("x32", table.concat(r, ":"))
  40. end
  41. function T.platforms.filter_OnDuplicateKeys()
  42. platforms { "Native", "x32" }
  43. premake.bake.buildconfigs()
  44. r = premake.filterplatforms(sln, testmap, "x32")
  45. test.isequal("Native", table.concat(r, ":"))
  46. end