35#include <boost/test/unit_test.hpp>
40#include <boost/test/tools/floating_point_comparison.hpp>
41#include <boost/test/unit_test.hpp>
45namespace BandedMatrixStoragePolicyUnitTests
66 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
68 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
70 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
72 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
74 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
76 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
90 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
92 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
94 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
96 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
111 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
113 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
115 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
126 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
134 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
140 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
142 BOOST_CHECK_EQUAL(std::numeric_limits<unsigned int>::max(),
156 NekDouble buf[] = {0, 0, 1, 4, 0, 2, 5, 8, 3, 6, 9, 11, 7, 10, 12, 0};
159 BOOST_CHECK_EQUAL(1, m(0, 0));
160 m.SetValue(0, 0, 19);
161 BOOST_CHECK_EQUAL(19, m(0, 0));
162 BOOST_CHECK_EQUAL(2, m(0, 1));
163 m.SetValue(0, 1, 20);
164 BOOST_CHECK_EQUAL(20, m(0, 1));
165 BOOST_CHECK_EQUAL(3, m(0, 2));
166 m.SetValue(0, 2, 21);
167 BOOST_CHECK_EQUAL(21, m(0, 2));
168 BOOST_CHECK_EQUAL(0, m(0, 3));
171 BOOST_CHECK_EQUAL(4, m(1, 0));
172 m.SetValue(1, 0, 22);
173 BOOST_CHECK_EQUAL(22, m(1, 0));
174 BOOST_CHECK_EQUAL(5, m(1, 1));
175 m.SetValue(1, 1, 23);
176 BOOST_CHECK_EQUAL(23, m(1, 1));
177 BOOST_CHECK_EQUAL(6, m(1, 2));
178 m.SetValue(1, 2, 24);
179 BOOST_CHECK_EQUAL(24, m(1, 2));
180 BOOST_CHECK_EQUAL(7, m(1, 3));
181 m.SetValue(1, 3, 25);
182 BOOST_CHECK_EQUAL(25, m(1, 3));
184 BOOST_CHECK_EQUAL(0, m(2, 0));
186 BOOST_CHECK_EQUAL(8, m(2, 1));
187 m.SetValue(2, 1, 26);
188 BOOST_CHECK_EQUAL(26, m(2, 1));
189 BOOST_CHECK_EQUAL(9, m(2, 2));
190 m.SetValue(2, 2, 27);
191 BOOST_CHECK_EQUAL(27, m(2, 2));
192 BOOST_CHECK_EQUAL(10, m(2, 3));
193 m.SetValue(2, 3, 28);
194 BOOST_CHECK_EQUAL(28, m(2, 3));
196 BOOST_CHECK_EQUAL(0, m(3, 0));
198 BOOST_CHECK_EQUAL(0, m(3, 1));
200 BOOST_CHECK_EQUAL(11, m(3, 2));
201 m.SetValue(3, 2, 29);
202 BOOST_CHECK_EQUAL(29, m(3, 2));
203 BOOST_CHECK_EQUAL(12, m(3, 3));
204 m.SetValue(3, 3, 30);
205 BOOST_CHECK_EQUAL(30, m(3, 3));
BOOST_AUTO_TEST_CASE(TestCalculateStorageSizeAndCalculateNumberOfRows)
void RedirectCerrIfNeeded()
The above copyright notice and this permission notice shall be included.
static unsigned int CalculateNumberOfRows(unsigned int totalRows, unsigned int subDiags, unsigned int superDiags)
static unsigned int CalculateIndex(unsigned int totalRows, unsigned int totalColumns, unsigned int row, unsigned int column, unsigned int sub, unsigned int super)
static unsigned int GetRequiredStorageSize(unsigned int totalRows, unsigned int totalColumns, unsigned int subDiags, unsigned int superDiags)
Calculates and returns the storage size required.