@@ -323,32 +323,37 @@ namespace xf
323323 EXPECT_EQ (fdim (sa, a.select (sel)), fdim (sa, a).select (sel));
324324 }
325325
326- // TODO: enable this when xoptional is fixed
327- /* TEST(xvariable_math, maximum)
326+ TEST (xvariable_math, maximum)
328327 {
329- variable_type a = make_test_variable();
330- dict_type sel = make_selector_aa();
331- EXPECT_EQ(std::max(a.select(sel), a.select(sel)), maximum(a, a).select(sel));
328+ auto missing = xtl::missing<double >();
329+ using data_type = xt::xoptional_assembly<xt::xarray<double >, xt::xarray<bool >>;
332330
333- double sb = 1.2 ;
334- EXPECT_EQ(std::max(a.select(sel), sb), maximum(a, sb).select(sel) );
331+ variable_type a = make_test_variable () ;
332+ variable_type b = make_test_variable2 ( );
335333
336- double sa = 1.2;
337- EXPECT_EQ(std::max(sa, a.select(sel)), maximum(sa, a).select(sel));
334+ variable_type res = maximum (a, b);
335+ data_type expected = {{{ 1 , 2 , missing},
336+ {missing, missing, missing}},
337+ {{ 11 , 12 , 13 },
338+ {missing, 15 , 16 }}};
339+ EXPECT_EQ (res.data (), expected);
338340 }
339341
340342 TEST (xvariable_math, minimum)
341343 {
342- variable_type a = make_test_variable();
343- dict_type sel = make_selector_aa();
344- EXPECT_EQ(std::min(a.select(sel), a.select(sel)), minimum(a, a).select(sel));
344+ auto missing = xtl::missing<double >();
345+ using data_type = xt::xoptional_assembly<xt::xarray<double >, xt::xarray<bool >>;
345346
346- double sb = 1.2 ;
347- EXPECT_EQ(std::min(a.select(sel), sb), minimum(a, sb).select(sel) );
347+ variable_type a = make_test_variable () ;
348+ variable_type b = make_test_variable2 ( );
348349
349- double sa = 1.2;
350- EXPECT_EQ(std::min(sa, a.select(sel)), minimum(sa, a).select(sel));
351- }*/
350+ variable_type res = minimum (a, b);
351+ data_type expected = {{{ 1 , 1 , missing},
352+ {missing, missing, missing}},
353+ {{ 7 , 7 , 7 },
354+ {missing, 9 , 9 }}};
355+ EXPECT_EQ (res.data (), expected);
356+ }
352357
353358 TEST (xvariable_math, clip)
354359 {
0 commit comments