1 #include "TpetraCore_config.h"
2 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
3 #include "Tpetra_MultiVectorFiller.hpp"
11 using Teuchos::ArrayView;
12 using Tpetra::Details::sortAndMergeIn;
14 Array<int> allEntries (5);
15 for (Array<int>::size_type k = 0; k < 5; ++k) {
16 allEntries[k] = 2 * k;
18 Array<int> newEntries (4);
24 ArrayView<int> result =
25 sortAndMergeIn<int> (allEntries, allEntries.view (0, 5), newEntries());
26 TEUCHOS_TEST_FOR_EXCEPTION(
27 result.size() != 8, std::logic_error,
28 "Returned ArrayView should have size 8, but instead has size "
29 << result.size() <<
".");
30 TEUCHOS_TEST_FOR_EXCEPTION(
31 allEntries.size() < 8, std::logic_error,
32 "Input/output Array argument should have size at least 8, but instead has "
33 "size " << allEntries.size() <<
".");
36 ArrayView<int>::size_type firstBadIndex = -1;
37 for (ArrayView<int>::size_type k = 0; k < result.size(); ++k) {
38 if (result[k] != allEntries[k]) {
44 TEUCHOS_TEST_FOR_EXCEPTION(
45 success, std::logic_error,
"Returned ArrayView and the input/output "
46 "Array argument don't match. First nonmatching array index is "
47 << firstBadIndex <<
".");
49 Array<int> expectedEntries (8);
50 expectedEntries[0] = -1;
51 expectedEntries[1] = 0;
52 expectedEntries[2] = 2;
53 expectedEntries[3] = 3;
54 expectedEntries[4] = 4;
55 expectedEntries[5] = 6;
56 expectedEntries[6] = 8;
57 expectedEntries[7] = 11;
58 for (ArrayView<int>::size_type k = 0; k < result.size(); ++k) {
59 if (expectedEntries[k] != result[k]) {
65 TEUCHOS_TEST_FOR_EXCEPTION(success, std::logic_error,
"Returned ArrayView "
66 "and the expected results don't match. First nonmatching array index is "
67 << firstBadIndex <<
".");
72 #endif // TPETRA_ENABLE_DEPRECATED_CODE