// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #if __cplusplus <= 199711L #include int main() { std::cout << "Test not applicable due to lack of C++11 support in the compiler" << std::endl; return 0; } #else #ifdef BOOST_QVM_TEST_SINGLE_HEADER # include BOOST_QVM_TEST_SINGLE_HEADER #else # include #endif #include #include template struct same_type; template struct same_type { }; int main() { using namespace boost::qvm; BOOST_QVM_STATIC_ASSERT((is_vec>::value)); BOOST_QVM_STATIC_ASSERT((is_vec>::value)); BOOST_QVM_STATIC_ASSERT((is_vec const>::value)); BOOST_QVM_STATIC_ASSERT((is_vec const>::value)); BOOST_QVM_STATIC_ASSERT((!is_vec,3>>::value)); BOOST_QVM_STATIC_ASSERT((!is_vec,3>,3>>::value)); BOOST_QVM_STATIC_ASSERT((vec_traits>::dim==3)); BOOST_QVM_STATIC_ASSERT((vec_traits>::dim==3)); BOOST_QVM_STATIC_ASSERT((vec_traits const>::dim==3)); BOOST_QVM_STATIC_ASSERT((vec_traits const>::dim==3)); same_type>::scalar_type,int>(); same_type>::scalar_type,int const>(); same_type const>::scalar_type,int>(); same_type const>::scalar_type,int const>(); same_type< vec, deduce_vec>::type >(); same_type< vec, deduce_vec>::type >(); same_type< vec, deduce_vec const>::type >(); same_type< vec, deduce_vec const>::type >(); std::array arr1 = {0,1,2}; std::array arr2 = {0,1,2}; std::array const arr3 = {0,1,2}; std::array const arr4 = {0,1,2}; BOOST_TEST((vec_traits>::read_element<0>(arr1)==0)); BOOST_TEST((vec_traits>::read_element<1>(arr1)==1)); BOOST_TEST((vec_traits>::read_element<2>(arr1)==2)); BOOST_TEST((vec_traits>::read_element<0>(arr2)==0)); BOOST_TEST((vec_traits>::read_element<1>(arr2)==1)); BOOST_TEST((vec_traits>::read_element<2>(arr2)==2)); BOOST_TEST((vec_traits const>::read_element<0>(arr3)==0)); BOOST_TEST((vec_traits const>::read_element<1>(arr3)==1)); BOOST_TEST((vec_traits const>::read_element<2>(arr3)==2)); BOOST_TEST((vec_traits const>::read_element<0>(arr4)==0)); BOOST_TEST((vec_traits const>::read_element<1>(arr4)==1)); BOOST_TEST((vec_traits const>::read_element<2>(arr4)==2)); BOOST_TEST((vec_traits>::read_element_idx(0,arr1)==0)); BOOST_TEST((vec_traits>::read_element_idx(1,arr1)==1)); BOOST_TEST((vec_traits>::read_element_idx(2,arr1)==2)); BOOST_TEST((vec_traits>::read_element_idx(0,arr2)==0)); BOOST_TEST((vec_traits>::read_element_idx(1,arr2)==1)); BOOST_TEST((vec_traits>::read_element_idx(2,arr2)==2)); BOOST_TEST((vec_traits const>::read_element_idx(0,arr3)==0)); BOOST_TEST((vec_traits const>::read_element_idx(1,arr3)==1)); BOOST_TEST((vec_traits const>::read_element_idx(2,arr3)==2)); BOOST_TEST((vec_traits const>::read_element_idx(0,arr4)==0)); BOOST_TEST((vec_traits const>::read_element_idx(1,arr4)==1)); BOOST_TEST((vec_traits const>::read_element_idx(2,arr4)==2)); BOOST_TEST((&vec_traits>::write_element<0>(arr1)==&arr1[0])); BOOST_TEST((&vec_traits>::write_element<1>(arr1)==&arr1[1])); BOOST_TEST((&vec_traits>::write_element<2>(arr1)==&arr1[2])); BOOST_TEST((&vec_traits>::write_element_idx(0,arr1)==&arr1[0])); BOOST_TEST((&vec_traits>::write_element_idx(1,arr1)==&arr1[1])); BOOST_TEST((&vec_traits>::write_element_idx(2,arr1)==&arr1[2])); return boost::report_errors(); } #endif