mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Renamed namespace to 'gsl'. Renamed macro to configure testing.
This commit is contained in:
parent
d023ad51a7
commit
ef626fd33a
@ -39,7 +39,7 @@
|
||||
|
||||
#ifndef _NOEXCEPT
|
||||
|
||||
#ifdef SAFER_CPP_TESTING
|
||||
#ifdef GSL_THROWS_FOR_TESTING
|
||||
#define _NOEXCEPT
|
||||
#else
|
||||
#define _NOEXCEPT noexcept
|
||||
@ -47,7 +47,7 @@
|
||||
|
||||
#else // _NOEXCEPT
|
||||
|
||||
#ifdef SAFER_CPP_TESTING
|
||||
#ifdef GSL_THROWS_FOR_TESTING
|
||||
#undef _NOEXCEPT
|
||||
#define _NOEXCEPT
|
||||
#endif
|
||||
@ -59,7 +59,7 @@
|
||||
#pragma warning(disable: 4351) // warns about newly introduced aggregate initializer behavior
|
||||
#endif // _MSC_VER <= 1800
|
||||
|
||||
namespace Guide {
|
||||
namespace gsl {
|
||||
|
||||
/*
|
||||
** begin definitions of index and bounds
|
||||
@ -2279,7 +2279,7 @@ general_array_view_iterator<ArrayView> operator+(typename general_array_view_ite
|
||||
return rhs + n;
|
||||
}
|
||||
|
||||
} // namespace Guide
|
||||
} // namespace gsl
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#undef constexpr
|
||||
|
@ -22,14 +22,14 @@
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Guide
|
||||
namespace gsl
|
||||
{
|
||||
|
||||
//
|
||||
// Having "fail fast" result in an exception makes unit testing
|
||||
// the GSL classes that rely upon it much simpler.
|
||||
//
|
||||
#if defined(SAFER_CPP_TESTING)
|
||||
#if defined(GSL_THROWS_FOR_TESTING)
|
||||
|
||||
struct fail_fast : public std::runtime_error
|
||||
{
|
||||
@ -45,7 +45,7 @@ inline void fail_fast_assert(bool cond, const char* const message) { if (!cond)
|
||||
inline void fail_fast_assert(bool cond) { if (!cond) std::terminate(); }
|
||||
inline void fail_fast_assert(bool cond, const char* const) { if (!cond) std::terminate(); }
|
||||
|
||||
#endif // SAFER_CPP_TESTING
|
||||
#endif // GSL_THROWS_FOR_TESTING
|
||||
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "string_view.h" // zstring, string_view, zstring_builder...
|
||||
#include <memory>
|
||||
|
||||
namespace Guide
|
||||
namespace gsl
|
||||
{
|
||||
|
||||
//
|
||||
@ -38,8 +38,8 @@ using owner = T;
|
||||
//
|
||||
// GSL.assert: assertions
|
||||
//
|
||||
#define Expects(x) Guide::fail_fast_assert((x))
|
||||
#define Ensures(x) Guide::fail_fast_assert((x))
|
||||
#define Expects(x) gsl::fail_fast_assert((x))
|
||||
#define Ensures(x) gsl::fail_fast_assert((x))
|
||||
|
||||
//
|
||||
// GSL.util: utilities
|
||||
@ -354,6 +354,6 @@ private:
|
||||
|
||||
template<class T> using maybe_null = maybe_null_ret<T>;
|
||||
|
||||
} // namespace Guide
|
||||
} // namespace gsl
|
||||
|
||||
#endif // GSL_GSL_H
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "array_view.h"
|
||||
#include <cstring>
|
||||
|
||||
namespace Guide
|
||||
namespace gsl
|
||||
{
|
||||
//
|
||||
// czstring and wzstring
|
||||
@ -164,7 +164,7 @@ public:
|
||||
size_type length() const { return sv_.length(); }
|
||||
|
||||
pointer assume0() const { return data(); }
|
||||
string_view_type ensure_z() const { return Guide::ensure_z(sv_); }
|
||||
string_view_type ensure_z() const { return gsl::ensure_z(sv_); }
|
||||
|
||||
iterator begin() const { return sv_.begin(); }
|
||||
iterator end() const { return sv_.end(); }
|
||||
|
@ -9,7 +9,7 @@ include_directories(
|
||||
./unittest-cpp
|
||||
)
|
||||
|
||||
add_definitions(-DSAFER_CPP_TESTING)
|
||||
add_definitions(-DGSL_THROWS_FOR_TESTING)
|
||||
|
||||
if(MSVC14 OR MSVC12) # has the support we need
|
||||
# remove unnecessary warnings about unchecked iterators
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace Guide;
|
||||
using namespace gsl;
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -261,8 +261,8 @@ SUITE(array_view_tests)
|
||||
int a[30][4][5];
|
||||
|
||||
auto av = as_array_view(a);
|
||||
auto sub = av.section({15, 0, 0}, Guide::index<3>{2, 2, 2});
|
||||
auto subsub = sub.section({1, 0, 0}, Guide::index<3>{1, 1, 1});
|
||||
auto sub = av.section({15, 0, 0}, gsl::index<3>{2, 2, 2});
|
||||
auto subsub = sub.section({1, 0, 0}, gsl::index<3>{1, 1, 1});
|
||||
}
|
||||
|
||||
TEST(array_view_section)
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <UnitTest++/UnitTest++.h>
|
||||
#include <gsl.h>
|
||||
|
||||
using namespace Guide;
|
||||
using namespace gsl;
|
||||
|
||||
SUITE(assertion_tests)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
using namespace Guide;
|
||||
using namespace gsl;
|
||||
|
||||
SUITE(at_tests)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
using namespace Guide;;
|
||||
using namespace gsl;;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
using namespace Guide;
|
||||
using namespace gsl;
|
||||
|
||||
struct MyBase { bool foo() { return true; } };
|
||||
struct MyDerived : public MyBase {};
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <gsl.h>
|
||||
#include <vector>
|
||||
|
||||
using namespace Guide;
|
||||
using namespace gsl;
|
||||
|
||||
struct MyBase {};
|
||||
struct MyDerived : public MyBase {};
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <gsl.h>
|
||||
#include <functional>
|
||||
|
||||
using namespace Guide;
|
||||
using namespace gsl;
|
||||
|
||||
SUITE(owner_tests)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace std;
|
||||
using namespace Guide;
|
||||
using namespace gsl;
|
||||
|
||||
SUITE(string_view_tests)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <gsl.h>
|
||||
#include <functional>
|
||||
|
||||
using namespace Guide;
|
||||
using namespace gsl;
|
||||
|
||||
SUITE(utils_tests)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user