bignumber_test_printers.cpp 1000 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // bignumber_test_printers.cpp
  3. // bigdecimal
  4. //
  5. // Created by Sam Jaffe on 5/20/18.
  6. //
  7. #include "bignumber_test_printers.h"
  8. #include <iostream>
  9. void math::PrintTo(math::bigdecimal const & dec, std::ostream * out) {
  10. (*out) << dec.to_string() << "(" << dec.scale() << ")";
  11. }
  12. void math::PrintTo(math::biginteger const & dec, std::ostream * out) {
  13. (*out) << dec.to_string();
  14. }
  15. void PrintTo(BigDecPair const & tup, std::ostream * out) {
  16. (*out) << "{ lhs = ";
  17. math::PrintTo(tup.lhs, out);
  18. (*out) << ", rhs = ";
  19. math::PrintTo(tup.rhs, out);
  20. (*out) << " }";
  21. }
  22. void std::PrintTo(BigIntPair const & tup, std::ostream * out) {
  23. (*out) << "{ lhs = ";
  24. math::PrintTo(std::get<0>(tup), out);
  25. (*out) << ", rhs = ";
  26. math::PrintTo(std::get<1>(tup), out);
  27. (*out) << " }";
  28. }
  29. void PrintTo(ArithTuple const & tup, std::ostream * out) {
  30. (*out) << "{ lhs = ";
  31. math::PrintTo(tup.lhs, out);
  32. (*out) << ", rhs = ";
  33. math::PrintTo(tup.rhs, out);
  34. (*out) << " } -> " << tup.expected;
  35. }