forked from M-Labs/nac3
1
0
Fork 0
nac3/nac3core/irrt/test/test_ndarray_basic.hpp

30 lines
714 B
C++
Raw Normal View History

#pragma once
#include <test/includes.hpp>
namespace test {
namespace ndarray_basic {
void test_calc_size_from_shape_normal() {
// Test shapes with normal values
BEGIN_TEST();
2024-08-07 15:13:53 +08:00
int64_t shape[4] = {2, 3, 5, 7};
assert_values_match(
2024-08-07 15:13:53 +08:00
210L, ndarray::basic::util::calc_size_from_shape<int64_t>(4, shape));
}
void test_calc_size_from_shape_has_zero() {
// Test shapes with 0 in them
BEGIN_TEST();
2024-08-07 15:13:53 +08:00
int64_t shape[4] = {2, 0, 5, 7};
assert_values_match(
2024-08-07 15:13:53 +08:00
0L, ndarray::basic::util::calc_size_from_shape<int64_t>(4, shape));
}
void run() {
test_calc_size_from_shape_normal();
test_calc_size_from_shape_has_zero();
}
} // namespace ndarray_basic
} // namespace test