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:
+17
-18
@@ -15,9 +15,11 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <UnitTest++/UnitTest++.h>
|
||||
|
||||
#include <gsl/gsl>
|
||||
#include <vector>
|
||||
|
||||
#include <initializer_list>
|
||||
#include <vector>
|
||||
|
||||
using gsl::fail_fast;
|
||||
|
||||
@@ -25,8 +27,8 @@ SUITE(at_tests)
|
||||
{
|
||||
TEST(static_array)
|
||||
{
|
||||
int a[4] = { 1, 2, 3, 4 };
|
||||
const int (&c_a)[4] = a;
|
||||
int a[4] = {1, 2, 3, 4};
|
||||
const int(&c_a)[4] = a;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
CHECK(&gsl::at(a, i) == &a[i]);
|
||||
@@ -41,7 +43,7 @@ SUITE(at_tests)
|
||||
|
||||
TEST(std_array)
|
||||
{
|
||||
std::array<int, 4> a = { 1, 2, 3, 4 };
|
||||
std::array<int, 4> a = {1, 2, 3, 4};
|
||||
const std::array<int, 4>& c_a = a;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
@@ -57,7 +59,7 @@ SUITE(at_tests)
|
||||
|
||||
TEST(StdVector)
|
||||
{
|
||||
std::vector<int> a = { 1, 2, 3, 4 };
|
||||
std::vector<int> a = {1, 2, 3, 4};
|
||||
const std::vector<int>& c_a = a;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
@@ -73,26 +75,26 @@ SUITE(at_tests)
|
||||
|
||||
TEST(InitializerList)
|
||||
{
|
||||
std::initializer_list<int> a = { 1, 2, 3, 4 };
|
||||
std::initializer_list<int> a = {1, 2, 3, 4};
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
CHECK(gsl::at(a, i) == i+1);
|
||||
CHECK(gsl::at({1,2,3,4}, i) == i+1);
|
||||
CHECK(gsl::at(a, i) == i + 1);
|
||||
CHECK(gsl::at({1, 2, 3, 4}, i) == i + 1);
|
||||
}
|
||||
|
||||
CHECK_THROW(gsl::at(a, -1), fail_fast);
|
||||
CHECK_THROW(gsl::at(a, 4), fail_fast);
|
||||
CHECK_THROW(gsl::at({1,2,3,4}, -1), fail_fast);
|
||||
CHECK_THROW(gsl::at({1,2,3,4}, 4), fail_fast);
|
||||
CHECK_THROW(gsl::at({1, 2, 3, 4}, -1), fail_fast);
|
||||
CHECK_THROW(gsl::at({1, 2, 3, 4}, 4), fail_fast);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(_MSC_VER) || defined(__clang__) || _MSC_VER >= 1910
|
||||
static constexpr bool test_constexpr()
|
||||
{
|
||||
int a1[4] = { 1, 2, 3, 4 };
|
||||
const int (&c_a1)[4] = a1;
|
||||
std::array<int,4> a2 = { 1, 2, 3, 4 };
|
||||
int a1[4] = {1, 2, 3, 4};
|
||||
const int(&c_a1)[4] = a1;
|
||||
std::array<int, 4> a2 = {1, 2, 3, 4};
|
||||
const std::array<int, 4>& c_a2 = a2;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
@@ -101,7 +103,7 @@ static constexpr bool test_constexpr()
|
||||
// requires C++17:
|
||||
// if (&gsl::at(a2, i) != &a2[static_cast<std::size_t>(i)]) return false;
|
||||
if (&gsl::at(c_a2, i) != &c_a2[static_cast<std::size_t>(i)]) return false;
|
||||
if (gsl::at({1,2,3,4}, i) != i+1) return false;
|
||||
if (gsl::at({1, 2, 3, 4}, i) != i + 1) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -110,7 +112,4 @@ static constexpr bool test_constexpr()
|
||||
static_assert(test_constexpr(), "FAIL");
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
return UnitTest::RunAllTests();
|
||||
}
|
||||
int main() { return UnitTest::RunAllTests(); }
|
||||
|
||||
Reference in New Issue
Block a user