DISTRHO Plugin Framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.5KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include "tests.hpp"
  17. #define DPF_TEST_POINT_CPP
  18. #include "dgl/src/Geometry.cpp"
  19. // --------------------------------------------------------------------------------------------------------------------
  20. template <typename T>
  21. static int runTestsPerType()
  22. {
  23. USE_NAMESPACE_DGL;
  24. // basic usage
  25. {
  26. Point<T> p;
  27. DISTRHO_ASSERT_EQUAL(p.getX(), 0, "point start X value is 0");
  28. DISTRHO_ASSERT_EQUAL(p.getY(), 0, "point start Y value is 0");
  29. p.setX(5);
  30. DISTRHO_ASSERT_EQUAL(p.getX(), 5, "point X value changed to 5");
  31. DISTRHO_ASSERT_EQUAL(p.getY(), 0, "point start Y value remains 0");
  32. p.setY(7);
  33. DISTRHO_ASSERT_EQUAL(p.getX(), 5, "point X value remains 5");
  34. DISTRHO_ASSERT_EQUAL(p.getY(), 7, "point Y value changed to 7");
  35. }
  36. return 0;
  37. }
  38. int main()
  39. {
  40. if (const int ret = runTestsPerType<double>())
  41. return ret;
  42. if (const int ret = runTestsPerType<float>())
  43. return ret;
  44. if (const int ret = runTestsPerType<int>())
  45. return ret;
  46. if (const int ret = runTestsPerType<uint>())
  47. return ret;
  48. if (const int ret = runTestsPerType<short>())
  49. return ret;
  50. if (const int ret = runTestsPerType<ushort>())
  51. return ret;
  52. if (const int ret = runTestsPerType<long>())
  53. return ret;
  54. if (const int ret = runTestsPerType<ulong>())
  55. return ret;
  56. if (const int ret = runTestsPerType<long long>())
  57. return ret;
  58. if (const int ret = runTestsPerType<unsigned long long>())
  59. return ret;
  60. return 0;
  61. }
  62. // --------------------------------------------------------------------------------------------------------------------