forked from M-Labs/nac3
30 lines
714 B
C++
30 lines
714 B
C++
#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();
|
|
|
|
int64_t shape[4] = {2, 3, 5, 7};
|
|
assert_values_match(
|
|
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();
|
|
|
|
int64_t shape[4] = {2, 0, 5, 7};
|
|
assert_values_match(
|
|
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
|