test_printers.h 874 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // test_printers.h
  3. // math-test
  4. //
  5. // Created by Sam Jaffe on 5/5/19.
  6. // Copyright © 2019 Sam Jaffe. All rights reserved.
  7. //
  8. #ifndef test_printers_h
  9. #define test_printers_h
  10. #pragma once
  11. #include "game/math/shape.hpp"
  12. namespace math { namespace vector {
  13. inline std::ostream & operator<<(std::ostream & os, math::vec2 const & p) {
  14. return os << '[' << p[0] << ',' << p[1] << ']';
  15. }
  16. }}
  17. namespace math { namespace dim2 {
  18. inline bool operator==(line const & lhs, line const & rhs) {
  19. return lhs.first == rhs.first && lhs.second == rhs.second;
  20. }
  21. inline bool operator==(quad const & lhs, quad const & rhs) {
  22. return lhs.ll == rhs.ll && lhs.lr == rhs.lr && lhs.ul == rhs.ul &&
  23. lhs.ur == rhs.ur;
  24. }
  25. inline std::ostream & operator<<(std::ostream & os, line const & l) {
  26. return os << '[' << l.first << ',' << l.second << ']';
  27. }
  28. }}
  29. #endif /* test_printers_h */