foreign.cc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // -*- mode: c++; coding: utf-8 -*-
  2. // ra-ra/test - Regression for value_t, rank_s
  3. // (c) Daniel Llorens - 2020
  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 <numeric>
  9. #include <iostream>
  10. #include <iterator>
  11. #include "ra/test.hh"
  12. using std::cout, std::endl, std::flush, ra::TestRecorder;
  13. template <class C>
  14. struct bsphere
  15. {
  16. C c;
  17. };
  18. template <class C>
  19. double above(C const & p, bsphere<C> const & o)
  20. {
  21. return 0;
  22. }
  23. template <class B, class C>
  24. requires (0!=ra::rank_s<B>() && std::is_same_v<C, ra::value_t<B>>)
  25. double
  26. above(C const & p, B const & o)
  27. {
  28. return 1;
  29. }
  30. int main()
  31. {
  32. TestRecorder tr(cout);
  33. using P = ra::Small<double, 2>;
  34. tr.test_eq(0, above(P {1, 1}, bsphere<P> {{1, 2}}));
  35. tr.test_eq(1, above(P {1, 1}, ra::Small<P, 2> {{1, 2}, {3, 4}}));
  36. return tr.summary();
  37. }