forked from microsoft/GSL
Reformat files to follow clang-format style (#492)
Project files were not following the clang-format style. For people using IDEs were clang-format is always run after a save this would cause unwanted changes. This commit only applies "clang-format -i" to files.
This commit is contained in:
+54
-57
@@ -15,7 +15,9 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <UnitTest++/UnitTest++.h>
|
||||
|
||||
#include <gsl/multi_span>
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
@@ -23,81 +25,76 @@ using namespace gsl;
|
||||
|
||||
namespace
|
||||
{
|
||||
void use(std::ptrdiff_t&) {}
|
||||
void use(std::ptrdiff_t&) {}
|
||||
}
|
||||
|
||||
SUITE(bounds_test)
|
||||
{
|
||||
TEST(basic_bounds)
|
||||
{
|
||||
for (auto point : static_bounds<dynamic_range, 3, 4 > { 2 })
|
||||
{
|
||||
for (decltype(point)::size_type j = 0;
|
||||
j < static_cast<decltype(point)::size_type>(decltype(point)::rank);
|
||||
j++)
|
||||
{
|
||||
use(j);
|
||||
use(point[static_cast<std::size_t>(j)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
TEST(basic_bounds)
|
||||
{
|
||||
for (auto point : static_bounds<dynamic_range, 3, 4>{2}) {
|
||||
for (decltype(point)::size_type j = 0;
|
||||
j < static_cast<decltype(point)::size_type>(decltype(point)::rank); j++)
|
||||
{
|
||||
use(j);
|
||||
use(point[static_cast<std::size_t>(j)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(bounds_basic)
|
||||
{
|
||||
static_bounds<3, 4, 5> b;
|
||||
const auto a = b.slice();
|
||||
(void)a;
|
||||
static_bounds<4, dynamic_range, 2> x{ 4 };
|
||||
x.slice().slice();
|
||||
}
|
||||
TEST(bounds_basic)
|
||||
{
|
||||
static_bounds<3, 4, 5> b;
|
||||
const auto a = b.slice();
|
||||
(void) a;
|
||||
static_bounds<4, dynamic_range, 2> x{4};
|
||||
x.slice().slice();
|
||||
}
|
||||
|
||||
TEST (arrayview_iterator)
|
||||
{
|
||||
static_bounds<4, dynamic_range, 2> bounds{ 3 };
|
||||
TEST(arrayview_iterator)
|
||||
{
|
||||
static_bounds<4, dynamic_range, 2> bounds{3};
|
||||
|
||||
const auto itr = bounds.begin();
|
||||
(void)itr;
|
||||
const auto itr = bounds.begin();
|
||||
(void) itr;
|
||||
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||
multi_span<int, 4, dynamic_range, 2> av(nullptr, bounds);
|
||||
multi_span<int, 4, dynamic_range, 2> av(nullptr, bounds);
|
||||
|
||||
auto itr2 = av.cbegin();
|
||||
auto itr2 = av.cbegin();
|
||||
|
||||
for (auto& v : av) {
|
||||
v = 4;
|
||||
}
|
||||
fill(av.begin(), av.end(), 0);
|
||||
for (auto& v : av) {
|
||||
v = 4;
|
||||
}
|
||||
fill(av.begin(), av.end(), 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
TEST (bounds_convertible)
|
||||
{
|
||||
static_bounds<7, 4, 2> b1;
|
||||
static_bounds<7, dynamic_range, 2> b2 = b1;
|
||||
(void)b2;
|
||||
TEST(bounds_convertible)
|
||||
{
|
||||
static_bounds<7, 4, 2> b1;
|
||||
static_bounds<7, dynamic_range, 2> b2 = b1;
|
||||
(void) b2;
|
||||
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||
static_bounds<7, dynamic_range, 1> b4 = b2;
|
||||
static_bounds<7, dynamic_range, 1> b4 = b2;
|
||||
#endif
|
||||
|
||||
static_bounds<dynamic_range, dynamic_range, dynamic_range> b3 = b1;
|
||||
static_bounds<7, 4, 2> b4 = b3;
|
||||
(void)b4;
|
||||
static_bounds<dynamic_range, dynamic_range, dynamic_range> b3 = b1;
|
||||
static_bounds<7, 4, 2> b4 = b3;
|
||||
(void) b4;
|
||||
|
||||
static_bounds<dynamic_range> b11;
|
||||
static_bounds<dynamic_range> b11;
|
||||
|
||||
static_bounds<dynamic_range> b5;
|
||||
static_bounds<34> b6;
|
||||
static_bounds<dynamic_range> b5;
|
||||
static_bounds<34> b6;
|
||||
|
||||
b5 = static_bounds<20>();
|
||||
CHECK_THROW(b6 = b5, fail_fast);
|
||||
b5 = static_bounds<34>();
|
||||
b6 = b5;
|
||||
b5 = static_bounds<20>();
|
||||
CHECK_THROW(b6 = b5, fail_fast);
|
||||
b5 = static_bounds<34>();
|
||||
b6 = b5;
|
||||
|
||||
CHECK(b5 == b6);
|
||||
CHECK(b5.size() == b6.size());
|
||||
}
|
||||
CHECK(b5 == b6);
|
||||
CHECK(b5.size() == b6.size());
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, const char *[])
|
||||
{
|
||||
return UnitTest::RunAllTests();
|
||||
}
|
||||
int main(int, const char* []) { return UnitTest::RunAllTests(); }
|
||||
|
||||
Reference in New Issue
Block a user