66 static_assert(
decltype(
makeMultiArray<char>(3, 2))::dimensionCount() == 2,
"dimension count 2D");
67 static_assert(
decltype(
makeMultiArray<char>(3, 2, 3))::dimensionCount() == 3,
"dimension count 3D");
70 CPPUNIT_ASSERT_EQUAL(3_st, array1d.dimensionSize<0>());
71 CPPUNIT_ASSERT_EQUAL(3_st, array1d.totalSize());
75 CPPUNIT_ASSERT_EQUAL(
"abc"s,
string(array1d.data(), 3));
78 CPPUNIT_ASSERT_EQUAL(3_st, array2d.dimensionSize<0>());
79 CPPUNIT_ASSERT_EQUAL(2_st, array2d.dimensionSize<1>());
80 CPPUNIT_ASSERT_EQUAL(6_st, array2d.totalSize());
81 const char *
const data(array2d.data());
82 array2d.at(0, 0) =
'a';
83 array2d.at(0, 1) =
'b';
84 array2d.at(1, 0) =
'c';
85 array2d.at(1, 1) =
'd';
86 array2d.at(2, 0) =
'e';
87 array2d.at(2, 1) =
'f';
88 CPPUNIT_ASSERT_EQUAL(
"abcdef"s,
string(data, 6));
91 CPPUNIT_ASSERT_EQUAL(3_st, array3d.dimensionSize<0>());
92 CPPUNIT_ASSERT_EQUAL(2_st, array3d.dimensionSize<1>());
93 CPPUNIT_ASSERT_EQUAL(3_st, array3d.dimensionSize<2>());
94 CPPUNIT_ASSERT_EQUAL(18_st, array3d.totalSize());
95 array3d.at(0, 0, 0) =
'a';
96 array3d.at(0, 0, 1) =
'b';
97 array3d.at(0, 0, 2) =
'c';
98 array3d.at(0, 1, 0) =
'd';
99 array3d.at(0, 1, 1) =
'e';
100 array3d.at(0, 1, 2) =
'f';
101 array3d.at(1, 0, 0) =
'g';
102 array3d.at(1, 0, 1) =
'h';
103 array3d.at(1, 0, 2) =
'i';
104 array3d.at(1, 1, 0) =
'j';
105 array3d.at(1, 1, 1) =
'k';
106 array3d.at(1, 1, 2) =
'l';
107 array3d.at(2, 0, 0) =
'm';
108 array3d.at(2, 0, 1) =
'n';
109 array3d.at(2, 0, 2) =
'o';
110 array3d.at(2, 1, 0) =
'p';
111 array3d.at(2, 1, 1) =
'q';
112 array3d.at(2, 1, 2) =
'r';
113 CPPUNIT_ASSERT_EQUAL(
"abcdefghijklmnopqr"s,
string(array3d.data(), 18));
116 CPPUNIT_ASSERT_EQUAL(3_st, stackMultiArray.dimensionSize<0>());
117 CPPUNIT_ASSERT_EQUAL(3_st, stackMultiArray.dimensionSize<1>());
118 CPPUNIT_ASSERT_EQUAL(9_st, stackMultiArray.totalSize());
119 stackMultiArray.at(0, 0) =
'a';
120 stackMultiArray.at(0, 1) =
'b';
121 stackMultiArray.at(0, 2) =
'c';
122 stackMultiArray.at(1, 0) =
'd';
123 stackMultiArray.at(1, 1) =
'e';
124 stackMultiArray.at(1, 2) =
'f';
125 stackMultiArray.at(2, 0) =
'g';
126 stackMultiArray.at(2, 1) =
'h';
127 stackMultiArray.at(2, 2) =
'i';
128 CPPUNIT_ASSERT_EQUAL(
"abcdefghi"s,
string(stackMultiArray.data(), 9));
158 const auto workingCopyPathForNestedTestFile =
workingCopyPath(
"subdir/nested-testfile.txt");
159 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"creation of subdirectories in working dir",
"some file\n"s,
readFile(workingCopyPathForNestedTestFile));
161 const auto workingCopyPathUnderDifferentNameForNestedTestFile =
workingCopyPathAs(
"subdir/nested-testfile.txt",
"subdir2/foo.txt");
162 const auto splittedPath =
splitString<vector<string>>(workingCopyPathUnderDifferentNameForNestedTestFile,
"/", EmptyPartsTreat::Omit);
163 CPPUNIT_ASSERT_GREATEREQUAL(2_st, splittedPath.size());
164 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"different subdir",
"subdir2"s, splittedPath[splittedPath.size() - 2]);
165 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"different file name",
"foo.txt"s, splittedPath[splittedPath.size() - 1]);
166 CPPUNIT_ASSERT_EQUAL_MESSAGE(
167 "creation of subdirectories in working dir",
"some file\n"s,
readFile(workingCopyPathUnderDifferentNameForNestedTestFile));
171 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"printing hex numbers",
"0x10"s, ss.str());
CPP_UTILITIES_EXPORT std::string workingCopyPath(const std::string &relativeTestFilePath, WorkingCopyMode mode=WorkingCopyMode::CreateCopy)
Convenience function to invoke TestApplication::workingCopyPath().
CPP_UTILITIES_EXPORT std::string workingCopyPathAs(const std::string &relativeTestFilePath, const std::string &relativeWorkingCopyPath, WorkingCopyMode mode=WorkingCopyMode::CreateCopy)
Convenience function to invoke TestApplication::workingCopyPathAs().
constexpr FlagEnumClass & modFlagEnum(FlagEnumClass &flagVariable, FlagEnumClass relevantFlags, bool value)
Sets the specified relevantFlags in the specified flagVariable to the specified value.
Container splitString(Detail::StringParamForContainer< Container > string, Detail::StringParamForContainer< Container > delimiter, EmptyPartsTreat emptyPartsRole=EmptyPartsTreat::Keep, int maxParts=-1)
Splits the given string at the specified delimiter.