Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

57 řádky
1.4 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. #include <lol/engine-internal.h>
  11. #include <lolunit.h>
  12. namespace lol
  13. {
  14. lolunit_declare_fixture(BoxTest)
  15. {
  16. void SetUp() {}
  17. void TearDown() {}
  18. lolunit_declare_test(Box2DIsect)
  19. {
  20. box2 b1(vec2(0.f, 0.f), vec2(10.f, 10.f));
  21. box2 b2(vec2(5.f, 8.f), vec2(8.f, 12.f));
  22. box2 b3(vec2(5.f, 11.f), vec2(8.f, 13.f));
  23. lolunit_assert_equal(true, TestAABBVsAABB(b1, b2));
  24. lolunit_assert_equal(false, TestAABBVsAABB(b1, b3));
  25. box2 b4(vec2(96.f, 33.f), vec2(144.f, 129.f));
  26. box2 b5(vec2(264.f, 91.f), vec2(244.f, 71.f));
  27. lolunit_assert_equal(false, TestAABBVsAABB(b4, b5));
  28. }
  29. lolunit_declare_test(Box2DMove)
  30. {
  31. box2 b1(vec2(0.f, 0.f), vec2(1.f, 1.f));
  32. box2 b2(vec2(2.f, 2.f), vec2(3.f, 3.f));
  33. b1 += vec2(0.6f, 0.6f);
  34. lolunit_assert_equal(false, TestAABBVsAABB(b1, b2));
  35. b1 += vec2(0.6f, 0.6f);
  36. lolunit_assert_equal(true, TestAABBVsAABB(b1, b2));
  37. b1 -= vec2(0.0f, 0.6f);
  38. lolunit_assert_equal(false, TestAABBVsAABB(b1, b2));
  39. }
  40. };
  41. } /* namespace lol */