summaryrefslogtreecommitdiffstats
path: root/libcxx/test/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-05-11 19:42:16 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-05-11 19:42:16 +0000
commit3e519524c118651123eecf60c2bbc5d65ad9bac3 (patch)
treeb2dd4168cfe448920a602cd7d2e40f95da187153 /libcxx/test/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp
parent9132c59d43b6c590c9bb33496eebf9f192d6857a (diff)
downloadbcm5719-llvm-3e519524c118651123eecf60c2bbc5d65ad9bac3.tar.gz
bcm5719-llvm-3e519524c118651123eecf60c2bbc5d65ad9bac3.zip
libcxx initial import
llvm-svn: 103490
Diffstat (limited to 'libcxx/test/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp')
-rw-r--r--libcxx/test/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/libcxx/test/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp b/libcxx/test/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp
new file mode 100644
index 00000000000..d3cbce8fa4f
--- /dev/null
+++ b/libcxx/test/numerics/complex.number/complex.ops/scalar_times_complex.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+// complex<T>
+// operator*(const T& lhs, const complex<T>& rhs);
+
+#include <complex>
+#include <cassert>
+
+template <class T>
+void
+test(const T& lhs, const std::complex<T>& rhs, std::complex<T> x)
+{
+ assert(lhs * rhs == x);
+}
+
+template <class T>
+void
+test()
+{
+ T lhs(1.5);
+ std::complex<T> rhs(1.5, 2.5);
+ std::complex<T> x(2.25, 3.75);
+ test(lhs, rhs, x);
+}
+
+int main()
+{
+ test<float>();
+ test<double>();
+ test<long double>();
+}
OpenPOWER on IntegriCloud