MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / arrayIndexTest

Function arrayIndexTest

test/index.cpp:720–754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718
719template<typename T>
720void arrayIndexTest(string pTestFile, int dim) {
721 SUPPORTED_TYPE_CHECK(T);
722
723 vector<dim4> numDims;
724 vector<vector<T>> in;
725 vector<vector<T>> tests;
726
727 readTests<T, T, int>(pTestFile, numDims, in, tests);
728
729 dim4 dims0 = numDims[0];
730 dim4 dims1 = numDims[1];
731 af_array outArray = 0;
732 af_array inArray = 0;
733 af_array idxArray = 0;
734
735 ASSERT_SUCCESS(af_create_array(&inArray, &(in[0].front()), dims0.ndims(),
736 dims0.get(),
737 (af_dtype)dtype_traits<T>::af_type));
738
739 ASSERT_SUCCESS(af_create_array(&idxArray, &(in[1].front()), dims1.ndims(),
740 dims1.get(),
741 (af_dtype)dtype_traits<T>::af_type));
742
743 ASSERT_SUCCESS(af_lookup(&outArray, inArray, idxArray, dim));
744
745 vector<T> currGoldBar = tests[0];
746 dim4 goldDims = dims0;
747 goldDims[dim] = dims1[0];
748
749 ASSERT_VEC_ARRAY_EQ(currGoldBar, goldDims, outArray);
750
751 ASSERT_SUCCESS(af_release_array(inArray));
752 ASSERT_SUCCESS(af_release_array(idxArray));
753 ASSERT_SUCCESS(af_release_array(outArray));
754}
755
756TYPED_TEST(lookup, Dim0) {
757 arrayIndexTest<TypeParam>(string(TEST_DIR "/arrayindex/dim0.test"), 0);

Callers

nothing calls this directly

Calls 5

af_create_arrayFunction · 0.50
af_lookupFunction · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected