slic3r_version_tests.cpp 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #include "catch2/catch.hpp"
  2. #include "slic3r/Config/Version.hpp"
  3. TEST_CASE("Check parsing and comparing of config versions", "[Version]") {
  4. using namespace Slic3r;
  5. GUI::Config::Version v;
  6. v.config_version = *Semver::parse("1.1.2");
  7. v.min_slic3r_version = *Semver::parse("1.38.0");
  8. v.max_slic3r_version = Semver::inf();
  9. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.38.0")));
  10. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.38.0-alpha")));
  11. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.37.0-alpha")));
  12. // Test the prerelease status.
  13. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
  14. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
  15. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
  16. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
  17. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  18. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  19. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
  20. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0")));
  21. v.config_version = *Semver::parse("1.1.2-alpha");
  22. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
  23. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
  24. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
  25. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  26. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  27. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
  28. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
  29. v.config_version = *Semver::parse("1.1.2-alpha1");
  30. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
  31. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
  32. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
  33. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  34. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  35. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
  36. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
  37. v.config_version = *Semver::parse("1.1.2-beta");
  38. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
  39. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
  40. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
  41. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  42. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  43. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc")));
  44. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
  45. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
  46. v.config_version = *Semver::parse("1.1.2-rc");
  47. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
  48. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
  49. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
  50. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  51. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  52. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc")));
  53. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
  54. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
  55. v.config_version = *Semver::parse("1.1.2-rc2");
  56. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha")));
  57. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-alpha1")));
  58. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta")));
  59. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  60. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-beta1")));
  61. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc")));
  62. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.39.0-rc2")));
  63. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.39.0")));
  64. // Test the upper boundary.
  65. v.config_version = *Semver::parse("1.1.2");
  66. v.max_slic3r_version = *Semver::parse("1.39.3-beta1");
  67. REQUIRE(v.is_slic3r_supported(*Semver::parse("1.38.0")));
  68. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.38.0-alpha")));
  69. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.38.0-alpha1")));
  70. REQUIRE(! v.is_slic3r_supported(*Semver::parse("1.37.0-alpha")));
  71. }