ra-7.cc 993 B

123456789101112131415161718192021222324252627282930313233
  1. // -*- mode: c++; coding: utf-8 -*-
  2. /// @file ra-7.cc
  3. /// @brief Const / nonconst tests and regressions.
  4. // (c) Daniel Llorens - 2016
  5. // This library is free software; you can redistribute it and/or modify it under
  6. // the terms of the GNU Lesser General Public License as published by the Free
  7. // Software Foundation; either version 3 of the License, or (at your option) any
  8. // later version.
  9. #include <iostream>
  10. #include <iterator>
  11. #include "ra/mpdebug.hh"
  12. #include "ra/complex.hh"
  13. #include "ra/test.hh"
  14. #include "ra/ra.hh"
  15. using std::cout, std::endl, std::flush, std::tuple, ra::TestRecorder;
  16. using real = double;
  17. int main()
  18. {
  19. TestRecorder tr(std::cout);
  20. ra::Big<ra::Small<int, 2>, 0> b = ra::scalar(ra::Small<int, 2> {3, 4});
  21. // this requires a const/nonconst overload in ScalarFlat [ra39] because start(Scalar) just forwards.
  22. ([&b](auto const & c) { b = c; })(ra::scalar(ra::Small<int, 2> {1, 2}));
  23. tr.test_eq(ra::start({1, 2}), b());
  24. return tr.summary();
  25. }