1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
/*
* GridTools
*
* Copyright (c) 2014-2023, ETH Zurich
* All rights reserved.
*
* Please, refer to the LICENSE file in the root directory.
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <gridtools/stencil/global_parameter.hpp>
#include <gtest/gtest.h>
#include <gridtools/sid/concept.hpp>
namespace gridtools {
namespace stencil {
namespace {
TEST(global_parameter, smoke) {
auto testee = global_parameter(42.);
using testee_t = decltype(testee);
static_assert(is_sid<testee_t>());
static_assert(std::is_same_v<sid::element_type<testee_t>, double>);
static_assert(std::is_same_v<sid::reference_type<testee_t>, double>);
static_assert(sizeof(sid::ptr_holder_type<testee_t>) == sizeof(double));
static_assert(sizeof(sid::ptr_type<testee_t>) == sizeof(double));
static_assert(std::is_empty_v<sid::ptr_diff_type<testee_t>>);
static_assert(std::is_empty_v<sid::strides_type<testee_t>>);
static_assert(tuple_util::size<sid::strides_type<testee_t>>::value == 0);
EXPECT_EQ(42., *sid::get_origin(testee)());
}
} // namespace
} // namespace stencil
} // namespace gridtools
|