aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/mixingtypes.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2016-06-14 12:06:10 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2016-06-14 12:06:10 +0200
commita8c08e8b8e8bdd486a5a27b9f1e92c48ef4361cd (patch)
tree2c80ba97d7f03930acf827514ddce17baf1dfa00 /test/mixingtypes.cpp
parent756ac4a93dea57bf61079c4867e712a8c26d77f6 (diff)
Implement expr+scalar, scalar+expr, expr-scalar, and scalar-expr as binary expressions, and generalize supported scalar types.
The following functors are now deprecated: scalar_add_op, scalar_sub_op, and scalar_rsub_op.
Diffstat (limited to 'test/mixingtypes.cpp')
-rw-r--r--test/mixingtypes.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/mixingtypes.cpp b/test/mixingtypes.cpp
index dee4f35df..cf2207114 100644
--- a/test/mixingtypes.cpp
+++ b/test/mixingtypes.cpp
@@ -75,6 +75,18 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)
VERIFY_IS_APPROX(vcf / sf , vcf / complex<float>(sf));
VERIFY_IS_APPROX(vf / scf , vf.template cast<complex<float> >() / scf);
+ // check scalar increment
+ VERIFY_IS_APPROX(vcf.array() + sf , vcf.array() + complex<float>(sf));
+ VERIFY_IS_APPROX(sd + vcd.array(), complex<double>(sd) + vcd.array());
+ VERIFY_IS_APPROX(vf.array() + scf, vf.template cast<complex<float> >().array() + scf);
+ VERIFY_IS_APPROX(scd + vd.array() , scd + vd.template cast<complex<double> >().array());
+
+ // check scalar subtractions
+ VERIFY_IS_APPROX(vcf.array() - sf , vcf.array() - complex<float>(sf));
+ VERIFY_IS_APPROX(sd - vcd.array(), complex<double>(sd) - vcd.array());
+ VERIFY_IS_APPROX(vf.array() - scf, vf.template cast<complex<float> >().array() - scf);
+ VERIFY_IS_APPROX(scd - vd.array() , scd - vd.template cast<complex<double> >().array());
+
// check dot product
vf.dot(vf);
#if 0 // we get other compilation errors here than just static asserts