| 108 | COMPLEX_REAL_TESTS(cdouble, double) |
| 109 | |
| 110 | TEST(CAST_TEST, Test_JIT_DuplicateCastNoop) { |
| 111 | // Does a trivial cast - check JIT kernel trace to ensure a __noop is |
| 112 | // generated since we don't have a way to test it directly |
| 113 | SUPPORTED_TYPE_CHECK(double); |
| 114 | af_dtype ta = (af_dtype)dtype_traits<float>::af_type; |
| 115 | af_dtype tb = (af_dtype)dtype_traits<double>::af_type; |
| 116 | dim4 dims(num, 1, 1, 1); |
| 117 | af_array a, b, c; |
| 118 | af_randu(&a, dims.ndims(), dims.get(), ta); |
| 119 | |
| 120 | af_cast(&b, a, tb); |
| 121 | af_cast(&c, b, ta); |
| 122 | |
| 123 | std::vector<float> a_vals(num); |
| 124 | std::vector<float> c_vals(num); |
| 125 | ASSERT_SUCCESS(af_get_data_ptr((void **)&a_vals[0], a)); |
| 126 | ASSERT_SUCCESS(af_get_data_ptr((void **)&c_vals[0], c)); |
| 127 | |
| 128 | for (size_t i = 0; i < num; ++i) { ASSERT_FLOAT_EQ(a_vals[i], c_vals[i]); } |
| 129 | |
| 130 | af_release_array(a); |
| 131 | af_release_array(b); |
| 132 | af_release_array(c); |
| 133 | } |
| 134 | |
| 135 | TEST(Cast, ImplicitCast) { |
| 136 | using namespace af; |
nothing calls this directly
no test coverage detected