summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2016-05-17 14:52:19 +0000
committerMarshall Clow <mclow.lists@gmail.com>2016-05-17 14:52:19 +0000
commit4328c2bac88b6685e5f1e1fc8e14a58a9c0e7bd3 (patch)
treec6c06e71695d786f4c17274a5e0c83d1085cf98b /libcxx/test/std
parentbbd10b4579ef13707e97a06e7c7b981600f9d9e1 (diff)
downloadbcm5719-llvm-4328c2bac88b6685e5f1e1fc8e14a58a9c0e7bd3.tar.gz
bcm5719-llvm-4328c2bac88b6685e5f1e1fc8e14a58a9c0e7bd3.zip
Implement P0030R1: Introduce a 3-Argument Overload to std::hypot
llvm-svn: 269772
Diffstat (limited to 'libcxx/test/std')
-rw-r--r--libcxx/test/std/numerics/c.math/cmath.pass.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/libcxx/test/std/numerics/c.math/cmath.pass.cpp b/libcxx/test/std/numerics/c.math/cmath.pass.cpp
index 0b0d8628873..5b78925f0dc 100644
--- a/libcxx/test/std/numerics/c.math/cmath.pass.cpp
+++ b/libcxx/test/std/numerics/c.math/cmath.pass.cpp
@@ -79,6 +79,7 @@ Ambiguous fma(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); }
Ambiguous fmax(Ambiguous, Ambiguous){ return Ambiguous(); }
Ambiguous fmin(Ambiguous, Ambiguous){ return Ambiguous(); }
Ambiguous hypot(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous hypot(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); }
Ambiguous ilogb(Ambiguous){ return Ambiguous(); }
Ambiguous lgamma(Ambiguous){ return Ambiguous(); }
Ambiguous llrint(Ambiguous){ return Ambiguous(); }
@@ -1010,6 +1011,28 @@ void test_hypot()
static_assert((std::is_same<decltype(std::hypot((int)0, (int)0)), double>::value), "");
static_assert((std::is_same<decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(std::hypot(3,4) == 5);
+
+#if TEST_STD_VER > 14
+ static_assert((std::is_same<decltype(std::hypot((float)0, (float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (int)0, (unsigned long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((float)0, (double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(std::hypot((int)0, (int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous>::value), "");
+
+ assert(std::hypot(2,3,6) == 7);
+ assert(std::hypot(1,4,8) == 9);
+#endif
}
void test_ilogb()
OpenPOWER on IntegriCloud