Partway through removing configurable SizeType.
This commit is contained in:
1 parent
e0d10d1d1c
commit
f45fedbec2
4 files changed
+411
-462
No files matched your search
@@ -50,7 +50,7 @@ SUITE(array_view_tests)
|
||||
delete[] ptr.data();
|
||||
|
||||
|
||||
static_bounds<size_t, 4, dynamic_range, 2> bounds{ 3 };
|
||||
static_bounds<4, dynamic_range, 2> bounds{ 3 };
|
||||
|
||||
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||
array_view<int, 4, dynamic_range, 2> av(nullptr, bounds);
|
||||
@@ -151,9 +151,9 @@ SUITE(array_view_tests)
|
||||
|
||||
TEST(md_access)
|
||||
{
|
||||
unsigned int width = 5, height = 20;
|
||||
auto width = 5, height = 20;
|
||||
|
||||
unsigned int imgSize = width * height;
|
||||
auto imgSize = width * height;
|
||||
auto image_ptr = new int[imgSize][3];
|
||||
|
||||
// size check will be done
|
||||
@@ -162,9 +162,9 @@ SUITE(array_view_tests)
|
||||
iota(image_view.begin(), image_view.end(), 1);
|
||||
|
||||
int expected = 0;
|
||||
for (unsigned int i = 0; i < height; i++)
|
||||
for (auto i = 0; i < height; i++)
|
||||
{
|
||||
for (unsigned int j = 0; j < width; j++)
|
||||
for (auto j = 0; j < width; j++)
|
||||
{
|
||||
CHECK(expected + 1 == image_view[i][j][0]);
|
||||
CHECK(expected + 2 == image_view[i][j][1]);
|
||||
@@ -244,7 +244,7 @@ SUITE(array_view_tests)
|
||||
auto av8 = av7.as_array_view<int>();
|
||||
|
||||
CHECK(av8.size() == av6.size());
|
||||
for (size_t i = 0; i < av8.size(); i++)
|
||||
for (auto i = 0; i < av8.size(); i++)
|
||||
{
|
||||
CHECK(av8[i] == 1);
|
||||
}
|
||||
|
||||
+18
-18
@@ -23,16 +23,16 @@ using namespace gsl;;
|
||||
|
||||
namespace
|
||||
{
|
||||
void use(unsigned int&) {}
|
||||
void use(std::ptrdiff_t&) {}
|
||||
}
|
||||
|
||||
SUITE(bounds_test)
|
||||
{
|
||||
TEST(basic_bounds)
|
||||
{
|
||||
for (auto point : static_bounds <unsigned int, dynamic_range, 3, 4 > { 2 })
|
||||
for (auto point : static_bounds<dynamic_range, 3, 4 > { 2 })
|
||||
{
|
||||
for (unsigned int j = 0; j < decltype(point)::rank; j++)
|
||||
for (decltype(point)::size_type j = 0; j < decltype(point)::rank; j++)
|
||||
{
|
||||
use(j);
|
||||
use(point[j]);
|
||||
@@ -42,24 +42,24 @@ SUITE(bounds_test)
|
||||
|
||||
TEST(bounds_basic)
|
||||
{
|
||||
static_bounds<size_t, 3, 4, 5> b;
|
||||
static_bounds<3, 4, 5> b;
|
||||
auto a = b.slice();
|
||||
static_bounds<size_t, 4, dynamic_range, 2> x{ 4 };
|
||||
static_bounds<4, dynamic_range, 2> x{ 4 };
|
||||
x.slice().slice();
|
||||
}
|
||||
|
||||
TEST (arrayview_iterator)
|
||||
{
|
||||
static_bounds<size_t, 4, dynamic_range, 2> bounds{ 3 };
|
||||
static_bounds<4, dynamic_range, 2> bounds{ 3 };
|
||||
|
||||
auto itr = bounds.begin();
|
||||
|
||||
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||
array_view< int, 4, dynamic_range, 2> av(nullptr, bounds);
|
||||
array_view<int, 4, dynamic_range, 2> av(nullptr, bounds);
|
||||
|
||||
auto itr2 = av.cbegin();
|
||||
|
||||
for (auto & v : av) {
|
||||
for (auto& v : av) {
|
||||
v = 4;
|
||||
}
|
||||
fill(av.begin(), av.end(), 0);
|
||||
@@ -68,24 +68,24 @@ SUITE(bounds_test)
|
||||
|
||||
TEST (bounds_convertible)
|
||||
{
|
||||
static_bounds<size_t, 7, 4, 2> b1;
|
||||
static_bounds<size_t, 7, dynamic_range, 2> b2 = b1;
|
||||
static_bounds<7, 4, 2> b1;
|
||||
static_bounds<7, dynamic_range, 2> b2 = b1;
|
||||
|
||||
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||
static_bounds<size_t, 7, dynamic_range, 1> b4 = b2;
|
||||
static_bounds<7, dynamic_range, 1> b4 = b2;
|
||||
#endif
|
||||
|
||||
static_bounds<size_t, dynamic_range, dynamic_range, dynamic_range> b3 = b1;
|
||||
static_bounds<int, 7, 4, 2> b4 = b3;
|
||||
static_bounds<dynamic_range, dynamic_range, dynamic_range> b3 = b1;
|
||||
static_bounds<7, 4, 2> b4 = b3;
|
||||
|
||||
static_bounds<size_t, dynamic_range> b11;
|
||||
static_bounds<dynamic_range> b11;
|
||||
|
||||
static_bounds<size_t, dynamic_range> b5;
|
||||
static_bounds<size_t, 34> b6;
|
||||
static_bounds<dynamic_range> b5;
|
||||
static_bounds<34> b6;
|
||||
|
||||
b5 = static_bounds<size_t, 20>();
|
||||
b5 = static_bounds<20>();
|
||||
CHECK_THROW(b6 = b5, fail_fast);
|
||||
b5 = static_bounds<size_t, 34>();
|
||||
b5 = static_bounds<34>();
|
||||
b6 = b5;
|
||||
|
||||
CHECK(b5 == b6);
|
||||
|
||||
Reference in new issue
Block a user