testDimension2d.cpp 834 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (C) 2008-2012 Colin MacDonald
  2. // No rights reserved: this software is in the public domain.
  3. #include "testUtils.h"
  4. using namespace irr;
  5. using namespace core;
  6. /** Some very basic testing of dimension2df:
  7. operator+=
  8. operator!= (and thus implicitly operator==) */
  9. bool testDimension2d(void)
  10. {
  11. dimension2df dimension(100.f, 100.f);
  12. const dimension2df addDimension(200.f, -200.f);
  13. (void)(dimension += addDimension);
  14. if(dimension != dimension2df(300.f, -100.f))
  15. {
  16. logTestString("dimension2df != produced unexpected result.\n");
  17. assert_log(false);
  18. return false;
  19. }
  20. (void)(dimension -= addDimension);
  21. if(dimension != dimension2df(100.f, 100.f))
  22. {
  23. logTestString("dimension2df -= produced unexpected result.\n");
  24. assert_log(false);
  25. return false;
  26. }
  27. return true;
  28. }