NT2_TEST_CASE_TPL ( compare_less_equal_unsigned_int__2_0, NT2_SIMD_UNSIGNED_TYPES) { using nt2::compare_less_equal; using nt2::tag::compare_less_equal_; using nt2::load; using boost::simd::native; using nt2::meta::cardinal_of; typedef NT2_SIMD_DEFAULT_EXTENSION ext_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef native<T,ext_t> n_t; typedef n_t vT; typedef typename nt2::meta::as_integer<T>::type iT; typedef native<iT,ext_t> ivT; typedef typename nt2::meta::call<compare_less_equal_(vT,vT)>::type r_t; typedef typename nt2::meta::call<compare_less_equal_(T,T)>::type sr_t; typedef typename nt2::meta::scalar_of<r_t>::type ssr_t; double ulpd; ulpd=0.0; // specific values tests NT2_TEST_EQUAL(compare_less_equal(nt2::One<vT>(), nt2::One<vT>()), true); NT2_TEST_EQUAL(compare_less_equal(nt2::One<vT>(),nt2::Zero<vT>()), false); NT2_TEST_EQUAL(compare_less_equal(nt2::Zero<vT>(), nt2::Zero<vT>()), true); } // end of test for unsigned_int_
NT2_TEST_CASE_TPL ( compare_less_equal_real__2_0, NT2_REAL_TYPES) { using nt2::compare_less_equal; using nt2::tag::compare_less_equal_; typedef typename nt2::meta::as_integer<T>::type iT; typedef typename nt2::meta::call<compare_less_equal_(T,T)>::type r_t; typedef typename nt2::meta::scalar_of<r_t>::type ssr_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef nt2::logical<T> wished_r_t; // return type conformity test NT2_TEST( (boost::is_same < r_t, wished_r_t >::value) ); std::cout << std::endl; // specific values tests NT2_TEST_EQUAL(compare_less_equal(nt2::Inf<T>(), nt2::Inf<T>()), ssr_t(true)); NT2_TEST_EQUAL(compare_less_equal(nt2::Minf<T>(), nt2::Minf<T>()), ssr_t(true)); NT2_TEST_EQUAL(compare_less_equal(nt2::Nan<T>(), nt2::Nan<T>()), ssr_t(true)); NT2_TEST_EQUAL(compare_less_equal(nt2::One<T>(),nt2::Zero<T>()), ssr_t(false)); NT2_TEST_EQUAL(compare_less_equal(nt2::Zero<T>(), nt2::Zero<T>()), ssr_t(true)); } // end of test for floating_
NT2_TEST_CASE_TPL ( compare_less_equal_real__2_0, NT2_SIMD_REAL_TYPES) { using nt2::compare_less_equal; using nt2::tag::compare_less_equal_; using boost::simd::native; using nt2::meta::cardinal_of; typedef NT2_SIMD_DEFAULT_EXTENSION ext_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef native<T,ext_t> n_t; typedef n_t vT; typedef typename nt2::meta::as_integer<T>::type iT; typedef native<iT,ext_t> ivT; typedef typename nt2::meta::call<compare_less_equal_(vT,vT)>::type r_t; typedef typename nt2::meta::call<compare_less_equal_(T,T)>::type sr_t; typedef typename nt2::meta::scalar_of<r_t>::type ssr_t; // specific values tests NT2_TEST_EQUAL(compare_less_equal(nt2::Inf<vT>(), nt2::Inf<vT>()), ssr_t(true)); NT2_TEST_EQUAL(compare_less_equal(nt2::Minf<vT>(), nt2::Minf<vT>()), ssr_t(true)); NT2_TEST_EQUAL(compare_less_equal(nt2::Nan<vT>(), nt2::Nan<vT>()), ssr_t(true)); NT2_TEST_EQUAL(compare_less_equal(nt2::One<vT>(),nt2::Zero<vT>()), ssr_t(false)); NT2_TEST_EQUAL(compare_less_equal(nt2::Zero<vT>(), nt2::Zero<vT>()), ssr_t(true)); } // end of test for floating_
NT2_TEST_CASE_TPL ( compare_less_equal_signed_int__2_0, NT2_SIMD_INTEGRAL_SIGNED_TYPES) { using nt2::compare_less_equal; using nt2::tag::compare_less_equal_; using nt2::aligned_load; using boost::simd::native; using nt2::meta::cardinal_of; typedef NT2_SIMD_DEFAULT_EXTENSION ext_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef native<T,ext_t> n_t; typedef n_t vT; typedef typename nt2::meta::as_integer<T>::type iT; typedef native<iT,ext_t> ivT; typedef typename nt2::meta::call<compare_less_equal_(vT,vT)>::type r_t; typedef typename nt2::meta::call<compare_less_equal_(T,T)>::type sr_t; typedef typename nt2::meta::scalar_of<r_t>::type ssr_t; double ulpd; ulpd=0.0; // random verifications static const nt2::uint32_t NR = NT2_NB_RANDOM_TEST; { NT2_CREATE_BUF(tab_a0,T, NR, nt2::Valmin<T>()/2, nt2::Valmax<T>()/2); NT2_CREATE_BUF(tab_a1,T, NR, nt2::Valmin<T>()/2, nt2::Valmax<T>()/2); double ulp0, ulpd ; ulpd=ulp0=0.0; for(nt2::uint32_t j = 0; j < NR;j+=cardinal_of<n_t>::value) { vT a0 = aligned_load<vT>(&tab_a0[0],j); vT a1 = aligned_load<vT>(&tab_a1[0],j); r_t v = compare_less_equal(a0,a1); bool z = true; for(nt2::uint32_t i = 0; i< cardinal_of<n_t>::value; ++i) { if (a0[i]<=a1[i]) {z=true;break;} else if (a0[i]>a1[i]){z=false; break;} } NT2_TEST_EQUAL( v,sr_t(z)); } } } // end of test for signed_int_