ra-7.C 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // -*- mode: c++; coding: utf-8 -*-
  2. /// @file ra-7.C
  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.H"
  12. #include "ra/complex.H"
  13. #include "ra/format.H"
  14. #include "ra/test.H"
  15. #include "ra/big.H"
  16. #include "ra/operators.H"
  17. #include "ra/io.H"
  18. using std::cout, std::endl, std::flush, std::tuple;
  19. using real = double;
  20. int main()
  21. {
  22. TestRecorder tr(std::cout);
  23. ra::Big<ra::Small<int, 2>, 0> b = ra::scalar(ra::Small<int, 2> {3, 4});
  24. // this requires a const/nonconst overload in ScalarFlat [ra39] because start(Scalar) just forwards.
  25. ([&b](auto const & c) { b.view() = c; })(ra::scalar(ra::Small<int, 2> {1, 2}));
  26. tr.test_eq(ra::start({1, 2}), b());
  27. return tr.summary();
  28. }