diff --git a/test/test_xoperation.cpp b/test/test_xoperation.cpp index eb579f93d..99cf21e55 100644 --- a/test/test_xoperation.cpp +++ b/test/test_xoperation.cpp @@ -9,8 +9,10 @@ #include "gtest/gtest.h" #include + #include "xtensor/xarray.hpp" #include "xtensor/xtensor.hpp" +#include "xtensor/xoptional_assembly.hpp" namespace xt { @@ -490,6 +492,17 @@ namespace xt #endif } + TYPED_TEST(operation, where_optional) + { + using opt_type = xoptional_assembly>; + auto missing = xtl::missing(); + opt_type a = { { 1, missing, 3 },{ 0, 1, 0 },{ missing, 4, 1 } }; + xtl::xoptional b = 1.0; + opt_type res = where(a > b, b, a); + opt_type expected = { { 1, missing, 1 },{ 0, 1, 0 },{ missing, 1, 1 } }; + EXPECT_EQ(expected, res); + } + TYPED_TEST(operation, where_cast) { using int_container_2d = xop_test::rebind_container_t;