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

Function TYPED_TEST

test/diagonal.cpp:39–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37TYPED_TEST_SUITE(Diagonal, TestTypes);
38
39TYPED_TEST(Diagonal, Create) {
40 SUPPORTED_TYPE_CHECK(TypeParam);
41 try {
42 static const int size = 1000;
43 vector<TypeParam> input(size * size);
44 for (int i = 0; i < size; i++) { input[i] = i; }
45 for (int jj = 10; jj < size; jj += 100) {
46 array data(jj, &input.front(), afHost);
47 array out = diag(data, 0, false);
48
49 vector<TypeParam> h_out(out.elements());
50 out.host(&h_out.front());
51
52 for (int i = 0; i < (int)out.dims(0); i++) {
53 for (int j = 0; j < (int)out.dims(1); j++) {
54 if (i == j)
55 ASSERT_EQ(input[i], h_out[i * out.dims(0) + j]);
56 else
57 ASSERT_EQ(TypeParam(0), h_out[i * out.dims(0) + j]);
58 }
59 }
60 }
61 } catch (const exception& ex) { FAIL() << ex.what(); }
62}
63
64TYPED_TEST(Diagonal, DISABLED_CreateLargeDim) {
65 SUPPORTED_TYPE_CHECK(TypeParam);

Callers

nothing calls this directly

Calls 7

diagFunction · 0.85
deviceGCFunction · 0.85
constantFunction · 0.85
hostMethod · 0.80
minFunction · 0.70
elementsMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected