summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/special_functions/02_assoc_legendre/pr86655.cc
blob: fb4248d1c704e4105472cc644d0b186b3e60e4e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// { dg-do run { target c++11 } }
// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__ -ffp-contract=off" }

// Copyright (C) 2019-2022 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3.  If not see
// <http://www.gnu.org/licenses/>.

#include <initializer_list>
#include <cmath>
#if defined(__TEST_DEBUG)
#  include <iostream>
#  define VERIFY(A) \
  if (!(A)) \
    { \
      std::cout << "line " << __LINE__ \
	<< "  std::assoc_legendre(l, m, x) == 0: " << (A) \
	<< '\n'; \
    }
#else
#  include <testsuite_hooks.h>
#endif

template<typename _Tp>
  void
  test_m_gt_l()
  {
    bool test __attribute__((unused)) = true;
    for (auto l : {0u, 1u, 2u, 5u})
      for (auto m : {l + 1u, l + 2u})
	for (auto i : {-2, -1, 0, 1, 2})
	  {
	    auto x = _Tp(i * 0.5L);
	    VERIFY(std::assoc_legendre(l, m, x) == _Tp(0));
	  }
  }

int
main()
{
  test_m_gt_l<float>();
  test_m_gt_l<double>();
  test_m_gt_l<long double>();
}