From ef626fd33a2f22ac917394995270da225dbc3c5f Mon Sep 17 00:00:00 2001 From: Neil MacIntosh Date: Tue, 29 Sep 2015 16:41:37 -0700 Subject: [PATCH] Renamed namespace to 'gsl'. Renamed macro to configure testing. --- include/array_view.h | 8 ++++---- include/fail_fast.h | 6 +++--- include/gsl.h | 8 ++++---- include/string_view.h | 4 ++-- tests/CMakeLists.txt | 2 +- tests/array_view_tests.cpp | 6 +++--- tests/assertion_tests.cpp | 2 +- tests/at_tests.cpp | 2 +- tests/bounds_tests.cpp | 2 +- tests/maybenull_tests.cpp | 2 +- tests/notnull_tests.cpp | 2 +- tests/owner_tests.cpp | 2 +- tests/string_view_tests.cpp | 2 +- tests/utils_tests.cpp | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/array_view.h b/include/array_view.h index ca4f897..9db9d53 100644 --- a/include/array_view.h +++ b/include/array_view.h @@ -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 operator+(typename general_array_view_ite return rhs + n; } -} // namespace Guide +} // namespace gsl #if defined(_MSC_VER) #undef constexpr diff --git a/include/fail_fast.h b/include/fail_fast.h index 78a5102..477bace 100644 --- a/include/fail_fast.h +++ b/include/fail_fast.h @@ -22,14 +22,14 @@ #include #include -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 } diff --git a/include/gsl.h b/include/gsl.h index 95116dc..5ae4df6 100644 --- a/include/gsl.h +++ b/include/gsl.h @@ -23,7 +23,7 @@ #include "string_view.h" // zstring, string_view, zstring_builder... #include -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 using maybe_null = maybe_null_ret; -} // namespace Guide +} // namespace gsl #endif // GSL_GSL_H diff --git a/include/string_view.h b/include/string_view.h index 164c3ac..4076d52 100644 --- a/include/string_view.h +++ b/include/string_view.h @@ -22,7 +22,7 @@ #include "array_view.h" #include -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(); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0415db3..774413f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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 diff --git a/tests/array_view_tests.cpp b/tests/array_view_tests.cpp index ba251e8..918df9e 100644 --- a/tests/array_view_tests.cpp +++ b/tests/array_view_tests.cpp @@ -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) diff --git a/tests/assertion_tests.cpp b/tests/assertion_tests.cpp index 012a043..acd381a 100644 --- a/tests/assertion_tests.cpp +++ b/tests/assertion_tests.cpp @@ -17,7 +17,7 @@ #include #include -using namespace Guide; +using namespace gsl; SUITE(assertion_tests) { diff --git a/tests/at_tests.cpp b/tests/at_tests.cpp index 6a86307..d27dd9d 100644 --- a/tests/at_tests.cpp +++ b/tests/at_tests.cpp @@ -19,7 +19,7 @@ #include using namespace std; -using namespace Guide; +using namespace gsl; SUITE(at_tests) { diff --git a/tests/bounds_tests.cpp b/tests/bounds_tests.cpp index b14a113..c3f549f 100644 --- a/tests/bounds_tests.cpp +++ b/tests/bounds_tests.cpp @@ -19,7 +19,7 @@ #include using namespace std; -using namespace Guide;; +using namespace gsl;; namespace { diff --git a/tests/maybenull_tests.cpp b/tests/maybenull_tests.cpp index 661b26a..74d449f 100644 --- a/tests/maybenull_tests.cpp +++ b/tests/maybenull_tests.cpp @@ -19,7 +19,7 @@ #include #include -using namespace Guide; +using namespace gsl; struct MyBase { bool foo() { return true; } }; struct MyDerived : public MyBase {}; diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp index 46011b6..a9624b8 100644 --- a/tests/notnull_tests.cpp +++ b/tests/notnull_tests.cpp @@ -18,7 +18,7 @@ #include #include -using namespace Guide; +using namespace gsl; struct MyBase {}; struct MyDerived : public MyBase {}; diff --git a/tests/owner_tests.cpp b/tests/owner_tests.cpp index d985533..47c223a 100644 --- a/tests/owner_tests.cpp +++ b/tests/owner_tests.cpp @@ -18,7 +18,7 @@ #include #include -using namespace Guide; +using namespace gsl; SUITE(owner_tests) { diff --git a/tests/string_view_tests.cpp b/tests/string_view_tests.cpp index c382cf0..84b7f3f 100644 --- a/tests/string_view_tests.cpp +++ b/tests/string_view_tests.cpp @@ -20,7 +20,7 @@ #include using namespace std; -using namespace Guide; +using namespace gsl; SUITE(string_view_tests) { diff --git a/tests/utils_tests.cpp b/tests/utils_tests.cpp index 66b6d14..3090c7d 100644 --- a/tests/utils_tests.cpp +++ b/tests/utils_tests.cpp @@ -18,7 +18,7 @@ #include #include -using namespace Guide; +using namespace gsl; SUITE(utils_tests) {