ra-7.cc 940 B

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