Skip to content

Commit

Permalink
Adding testcase for xtensor_fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegeus committed Mar 15, 2022
1 parent 0f6f58a commit db26ad6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/test_sfinae.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "test_common_macros.hpp"
#include "xtensor/xtensor.hpp"
#include "xtensor/xarray.hpp"
// #include "xtensor/xfixed.hpp"
#include "xtensor/xfixed.hpp"
#include "xtensor/xview.hpp"

namespace xt
Expand All @@ -35,13 +35,13 @@ namespace xt
xt::xarray<size_t> a = {{9, 9, 9}, {9, 9, 9}};
xt::xtensor<size_t, 1> b = {9, 9};
xt::xtensor<size_t, 2> c = {{9, 9}, {9, 9}};
// xt::xtensor_fixed<size_t, xt::xshape<2, 2>> d = {{9, 9}, {9, 9}};
xt::xtensor_fixed<size_t, xt::xshape<2, 2>> d = {{9, 9}, {9, 9}};
auto v = xt::view(c, 0, xt::all());

EXPECT_TRUE(sfinae_rank_basic_func(a) == 0ul);
EXPECT_TRUE(sfinae_rank_basic_func(b) == 0ul);
EXPECT_TRUE(sfinae_rank_basic_func(c) == 2ul);
// EXPECT_TRUE(sfinae_rank_basic_func(d) == 2ul);
EXPECT_TRUE(sfinae_rank_basic_func(d) == 2ul);
EXPECT_TRUE(sfinae_rank_basic_func(v) == 0ul);
EXPECT_TRUE(sfinae_rank_basic_func(2ul * a) == 0ul);
EXPECT_TRUE(sfinae_rank_basic_func(2ul * b) == 0ul);
Expand Down Expand Up @@ -72,13 +72,13 @@ namespace xt
xt::xarray<size_t> a = {{9, 9, 9}, {9, 9, 9}};
xt::xtensor<size_t, 1> b = {9, 9};
xt::xtensor<size_t, 2> c = {{9, 9}, {9, 9}};
// xt::xtensor_fixed<size_t, xt::xshape<2, 2>> d = {{9, 9}, {9, 9}};
xt::xtensor_fixed<size_t, xt::xshape<2, 2>> d = {{9, 9}, {9, 9}};
auto v = xt::view(c, 0, xt::all());

EXPECT_TRUE(sfinae_rank_func(a) == 0ul);
EXPECT_TRUE(sfinae_rank_func(b) == 1ul);
EXPECT_TRUE(sfinae_rank_func(c) == 2ul);
// EXPECT_TRUE(sfinae_rank_func(d) == 2ul);
EXPECT_TRUE(sfinae_rank_func(d) == 2ul);
EXPECT_TRUE(sfinae_rank_func(v) == 0ul);
EXPECT_TRUE(sfinae_rank_func(2ul * a) == 0ul);
EXPECT_TRUE(sfinae_rank_func(2ul * b) == 0ul);
Expand All @@ -102,13 +102,13 @@ namespace xt
xt::xarray<size_t> a = {{9, 9, 9}, {9, 9, 9}};
xt::xtensor<size_t, 1> b = {9, 9};
xt::xtensor<size_t, 2> c = {{9, 9}, {9, 9}};
// xt::xtensor_fixed<size_t, xt::xshape<2, 2>> d = {{9, 9}, {9, 9}};
xt::xtensor_fixed<size_t, xt::xshape<2, 2>> d = {{9, 9}, {9, 9}};
auto v = xt::view(c, 0, xt::all());

EXPECT_TRUE(sfinae_fixed_func(a) == false);
EXPECT_TRUE(sfinae_fixed_func(b) == true);
EXPECT_TRUE(sfinae_fixed_func(c) == true);
// EXPECT_TRUE(sfinae_fixed_func(d) == 2ul);
EXPECT_TRUE(sfinae_fixed_func(d) == 2ul);
EXPECT_TRUE(sfinae_fixed_func(v) == false);
EXPECT_TRUE(sfinae_fixed_func(2ul * a) == false);
EXPECT_TRUE(sfinae_fixed_func(2ul * b) == false);
Expand Down

0 comments on commit db26ad6

Please sign in to comment.