Skip to content

Commit

Permalink
add where test with integer condition
Browse files Browse the repository at this point in the history
  • Loading branch information
alifahrri committed Dec 10, 2023
1 parent f9da7e0 commit 6939708
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions include/nmtools/testing/data/array/where.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,83 @@ NMTOOLS_TESTING_DECLARE_CASE(view, where)
}
};
}

NMTOOLS_TESTING_DECLARE_ARGS(case1b)
{
inline int8_t condition[10] = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0};
inline int8_t x[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
inline int8_t y[10] = {0,10,20,30,40,50,60,70,80,90};
NMTOOLS_CAST_ARRAYS(condition)
NMTOOLS_CAST_ARRAYS(x)
NMTOOLS_CAST_ARRAYS(y)
}
NMTOOLS_TESTING_DECLARE_EXPECT(case1b)
{
inline int8_t dim = 1;
inline int8_t shape[1] = {10};
inline int8_t result[10] = {0, 1, 2, 3, 4, 50, 60, 70, 80, 90};
}

NMTOOLS_TESTING_DECLARE_ARGS(case2b)
{
inline int8_t condition[3][4] = {
{0, 1, 1, 1},
{0, 0, 1, 1},
{0, 0, 0, 1},
};
inline int8_t x[3][1] = {
{0},
{1},
{2},
};
inline int8_t y[1][4] = {{10,11,12,13}};
NMTOOLS_CAST_ARRAYS(condition)
NMTOOLS_CAST_ARRAYS(x)
NMTOOLS_CAST_ARRAYS(y)
}
NMTOOLS_TESTING_DECLARE_EXPECT(case2b)
{
inline int8_t dim = 2;
inline int8_t shape[2] = {3,4};
inline int8_t result[3][4] = {
{10, 0, 0, 0},
{10, 11, 1, 1},
{10, 11, 12, 2},
};
}


NMTOOLS_TESTING_DECLARE_ARGS(case3b)
{
inline int8_t condition[3][4] = {
{0, 1, 1, 1},
{0, 0, 1, 1},
{0, 0, 0, 1},
};
inline int8_t x[1][3][1] = {
{
{0},
{1},
{2},
}
};
inline int8_t y[1][4] = {{10,11,12,13}};
NMTOOLS_CAST_ARRAYS(condition)
NMTOOLS_CAST_ARRAYS(x)
NMTOOLS_CAST_ARRAYS(y)
}
NMTOOLS_TESTING_DECLARE_EXPECT(case3b)
{
inline int8_t dim = 3;
inline int8_t shape[3] = {1,3,4};
inline int8_t result[1][3][4] = {
{
{10, 0, 0, 0},
{10, 11, 1, 1},
{10, 11, 12, 2},
}
};
}
#endif
}

Expand Down

0 comments on commit 6939708

Please sign in to comment.