summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoronqtam <vik.kirilov@gmail.com>2017-03-23 17:13:30 +0200
committeronqtam <vik.kirilov@gmail.com>2017-05-16 00:22:16 +0300
commit7ccebe0f9811316dbf5c06577a07e21a2eb242a1 (patch)
tree88977c48c32e61b7c597d583796ddc0f9d668ed9
parentcad5cf40ec3482b7dfbb5dee59cc68b6717e6388 (diff)
- added detection of rvalue reference support of compilers
-rw-r--r--doc/markdown/configuration.md17
-rw-r--r--doc/markdown/roadmap.md8
-rw-r--r--doctest/doctest.h44
-rw-r--r--doctest/parts/doctest_fwd.h44
-rw-r--r--scripts/random_dev_notes.md45
5 files changed, 142 insertions, 16 deletions
diff --git a/doc/markdown/configuration.md b/doc/markdown/configuration.md
index 8409884..868fd2d 100644
--- a/doc/markdown/configuration.md
+++ b/doc/markdown/configuration.md
@@ -23,10 +23,15 @@ Defining something ```globally``` means for every source file of the binary (exe
- [**```DOCTEST_CONFIG_COLORS_NONE```**](#doctest_config_colors_none)
- [**```DOCTEST_CONFIG_COLORS_WINDOWS```**](#doctest_config_colors_windows)
- [**```DOCTEST_CONFIG_COLORS_ANSI```**](#doctest_config_colors_ansi)
+
+Detection of modern C++ features:
+
+- [**```DOCTEST_CONFIG_WITH_RVALUE_REFERENCES```**](#doctest_config_with_rvalue_references)
- [**```DOCTEST_CONFIG_WITH_VARIADIC_MACROS```**](#doctest_config_with_variadic_macros)
- [**```DOCTEST_CONFIG_WITH_NULLPTR```**](#doctest_config_with_nullptr)
- [**```DOCTEST_CONFIG_WITH_LONG_LONG```**](#doctest_config_with_long_long)
- [**```DOCTEST_CONFIG_WITH_STATIC_ASSERT```**](#doctest_config_with_static_assert)
+- [**```DOCTEST_CONFIG_NO_RVALUE_REFERENCES```**](#doctest_config_no_rvalue_references)
- [**```DOCTEST_CONFIG_NO_VARIADIC_MACROS```**](#doctest_config_no_variadic_macros)
- [**```DOCTEST_CONFIG_NO_NULLPTR```**](#doctest_config_no_nullptr)
- [**```DOCTEST_CONFIG_NO_LONG_LONG```**](#doctest_config_no_long_long)
@@ -189,6 +194,12 @@ This will force the support for colors in the console output to use ANSI escape
This should be defined only in the source file where the library is implemented (it's relevant only there).
+### **```DOCTEST_CONFIG_WITH_RVALUE_REFERENCES```**
+
+doctest tries to detect if c++11 rvalue references are available but if it doesn't detect it - the user might define this.
+
+This should be defined globally.
+
### **```DOCTEST_CONFIG_WITH_VARIADIC_MACROS```**
doctest tries to detect if c++11 variadic macros are available but if it doesn't detect it - the user might define this.
@@ -213,6 +224,12 @@ doctest tries to detect if c++11 ```static_assert()``` is available but if it do
This should be defined globally.
+### **```DOCTEST_CONFIG_NO_RVALUE_REFERENCES```**
+
+If doctest detects c++11 rvalue references support as available but the user knows better - this can be defined to disable it.
+
+This should be defined globally.
+
### **```DOCTEST_CONFIG_NO_VARIADIC_MACROS```**
If doctest detects c++11 variadic macros support as available but the user knows better - this can be defined to disable it.
diff --git a/doc/markdown/roadmap.md b/doc/markdown/roadmap.md
index 610c026..874ba17 100644
--- a/doc/markdown/roadmap.md
+++ b/doc/markdown/roadmap.md
@@ -15,10 +15,9 @@ Planned features for future releases - order may change.
- Parametric test cases (Value/Type-parameterized tests) - https://github.com/onqtam/doctest/issues/38
- crash handling: signals on UNIX platforms or structured exceptions on Windows (should also have DOCTEST_CONFIG_NO_SIGNAL_CATCHING)
- runtime performance
- - the set holding all registered tests should use a specialized allocator to minimize program startup time
- lazily stringify expressions - only when needed
- - pool allocator for the ```String``` class - currently very unoptimized
- get rid of local statics on the hot path - like in getContextState()
+ - make a pool allocator for the ```String``` class - currently very unoptimized
- benchmarking
- make the bench.py script more usable - with command line arguments
- redo the compile time ones - also look into CATCH_CONFIG_FAST_COMPILE
@@ -40,6 +39,7 @@ Planned features for future releases - order may change.
- jUnit/xUnit reporters
- a listener interface - similar to a reporter - look at Catch
- ability to have no output when everything succeeds
+- option to output summary only
- time stuff
- reporting running time of tests
- count a test case as failed if it exceeds X ms (but no force-killing!)
@@ -66,7 +66,6 @@ Planned features for future releases - order may change.
- failure reporting should print out previous SECTIONs for data-driven testing - as requested [here](https://github.com/philsquared/Catch/issues/734)
- ```Bitwise()``` class that has overloaded operators for comparison - to be used to check objects bitwise against each other
- detect floating point exceptions
-- option to output summary only
- support for tags
- may fail tag
- invisible tag
@@ -75,7 +74,7 @@ Planned features for future releases - order may change.
- integrate static analysis on the CI: **msvc**, **clang**, **cppcheck**
- extend Approx for types that have operator double - see [here](https://github.com/philsquared/Catch/issues/652) and [here](https://github.com/philsquared/Catch/pull/658)
- option to list files in which there are test cases who match the current filters
-- support for doing assertions in multiple threads - synchronize their access to shared doctest state
+- thread safety - asserts/subcases/captures should be safe to be used by multiple threads simultaneously
- support for running tests in parallel in multiple threads
- doctest in a GUI environment? with no console? APIs for attaching a console? querying if there is one? [investigate...](https://github.com/philsquared/Catch/blob/master/docs/configuration.md#stdout)
- ability to specify ASC/DESC for the order option
@@ -86,6 +85,7 @@ Planned features for future releases - order may change.
- https://msdn.microsoft.com/en-us/library/hh270865.aspx
- https://msdn.microsoft.com/en-us/library/hh598953.aspx
- also look into similar Xcode integration - https://github.com/philsquared/Catch/pull/454
+- the set holding all registered tests should use a specialized allocator to minimize program startup time
- ability to provide a temp folder that is cleared between each test case
- rework the examples folder - so the test runner is compiled only a few times - CI builds take a ton of time!
diff --git a/doctest/doctest.h b/doctest/doctest.h
index 29619af..8a4dbe3 100644
--- a/doctest/doctest.h
+++ b/doctest/doctest.h
@@ -98,6 +98,9 @@
// =================================================================================================
#if __cplusplus >= 201103L
+#ifndef DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#define DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
#ifndef DOCTEST_CONFIG_WITH_NULLPTR
#define DOCTEST_CONFIG_WITH_NULLPTR
#endif // DOCTEST_CONFIG_WITH_NULLPTR
@@ -112,13 +115,44 @@
#endif // DOCTEST_CONFIG_WITH_VARIADIC_MACROS
#endif // __cplusplus >= 201103L
+// MSVC C++11 feature support table: https://msdn.microsoft.com/en-us/library/hh567368.aspx
+// GCC C++11 feature support table: https://gcc.gnu.org/projects/cxx-status.html
+// MSVC version table:
+// MSVC++ xxxx _MSC_VER == xxxx (Visual Studio 2017)
+// MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
+// MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
+// MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
+// MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
+// MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008)
+// MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005)
+
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif // __has_feature
+
+// rvalue references
+
+#ifndef DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+#define DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // _MSC_VER
+#if defined(__clang__) && __has_feature(cxx_rvalue_references)
+#define DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // __clang__
+#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+#define DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // __GNUC__
+#endif // DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+
+#if defined(DOCTEST_CONFIG_NO_RVALUE_REFERENCES) && defined(DOCTEST_CONFIG_WITH_RVALUE_REFERENCES)
+#undef DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // DOCTEST_CONFIG_NO_RVALUE_REFERENCES
+
// nullptr
#ifndef DOCTEST_CONFIG_WITH_NULLPTR
-#ifdef __clang__
-#if __has_feature(cxx_nullptr)
+#if defined(__clang__) && __has_feature(cxx_nullptr)
#define DOCTEST_CONFIG_WITH_NULLPTR
-#endif // __has_feature(cxx_nullptr)
#endif // __clang__
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)
#define DOCTEST_CONFIG_WITH_NULLPTR
@@ -166,10 +200,8 @@
// static_assert
#ifndef DOCTEST_CONFIG_WITH_STATIC_ASSERT
-#ifdef __clang__
-#if __has_feature(cxx_static_assert)
+#if defined(__clang__) && __has_feature(cxx_static_assert)
#define DOCTEST_CONFIG_WITH_STATIC_ASSERT
-#endif // __has_feature(cxx_static_assert)
#endif // __clang__
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)
#define DOCTEST_CONFIG_WITH_STATIC_ASSERT
diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h
index 2e2dfd4..b392e55 100644
--- a/doctest/parts/doctest_fwd.h
+++ b/doctest/parts/doctest_fwd.h
@@ -95,6 +95,9 @@
// =================================================================================================
#if __cplusplus >= 201103L
+#ifndef DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#define DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
#ifndef DOCTEST_CONFIG_WITH_NULLPTR
#define DOCTEST_CONFIG_WITH_NULLPTR
#endif // DOCTEST_CONFIG_WITH_NULLPTR
@@ -109,13 +112,44 @@
#endif // DOCTEST_CONFIG_WITH_VARIADIC_MACROS
#endif // __cplusplus >= 201103L
+// MSVC C++11 feature support table: https://msdn.microsoft.com/en-us/library/hh567368.aspx
+// GCC C++11 feature support table: https://gcc.gnu.org/projects/cxx-status.html
+// MSVC version table:
+// MSVC++ xxxx _MSC_VER == xxxx (Visual Studio 2017)
+// MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
+// MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
+// MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
+// MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
+// MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008)
+// MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005)
+
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif // __has_feature
+
+// rvalue references
+
+#ifndef DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+#define DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // _MSC_VER
+#if defined(__clang__) && __has_feature(cxx_rvalue_references)
+#define DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // __clang__
+#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+#define DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // __GNUC__
+#endif // DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+
+#if defined(DOCTEST_CONFIG_NO_RVALUE_REFERENCES) && defined(DOCTEST_CONFIG_WITH_RVALUE_REFERENCES)
+#undef DOCTEST_CONFIG_WITH_RVALUE_REFERENCES
+#endif // DOCTEST_CONFIG_NO_RVALUE_REFERENCES
+
// nullptr
#ifndef DOCTEST_CONFIG_WITH_NULLPTR
-#ifdef __clang__
-#if __has_feature(cxx_nullptr)
+#if defined(__clang__) && __has_feature(cxx_nullptr)
#define DOCTEST_CONFIG_WITH_NULLPTR
-#endif // __has_feature(cxx_nullptr)
#endif // __clang__
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)
#define DOCTEST_CONFIG_WITH_NULLPTR
@@ -163,10 +197,8 @@
// static_assert
#ifndef DOCTEST_CONFIG_WITH_STATIC_ASSERT
-#ifdef __clang__
-#if __has_feature(cxx_static_assert)
+#if defined(__clang__) && __has_feature(cxx_static_assert)
#define DOCTEST_CONFIG_WITH_STATIC_ASSERT
-#endif // __has_feature(cxx_static_assert)
#endif // __clang__
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)
#define DOCTEST_CONFIG_WITH_STATIC_ASSERT
diff --git a/scripts/random_dev_notes.md b/scripts/random_dev_notes.md
index f1f0123..b23666e 100644
--- a/scripts/random_dev_notes.md
+++ b/scripts/random_dev_notes.md
@@ -49,3 +49,48 @@ slashdot?
- I suspect -Wsign-compare is not being silenced by the pragmas...
see this build - https://travis-ci.org/onqtam/game/jobs/196987454
check_eq(numDigits(0), 1); numDigits returns uint32
+
+== complete feature detection for deleted and defaulted functions
+
+//#ifndef DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS
+//#define DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS
+//#endif // DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS
+//#ifndef DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS
+//#define DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS
+//#endif // DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS
+
+// deleted functions
+
+//#ifndef DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS
+//#if defined(_MSC_VER) && (_MSC_VER >= 1800)
+//#define DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS
+//#endif // _MSC_VER
+//#if defined(__clang__) && __has_feature(cxx_deleted_functions)
+//#define DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS
+//#endif // __clang__
+//#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __GNUC__ > 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+//#define DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS
+//#endif // __GNUC__
+//#endif // DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS
+//
+//#if defined(DOCTEST_CONFIG_NO_DELETED_FUNCTIONS) && defined(DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS)
+//#undef DOCTEST_CONFIG_WITH_DELETED_FUNCTIONS
+//#endif // DOCTEST_CONFIG_NO_DELETED_FUNCTIONS
+
+// defaulted functions
+
+//#ifndef DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS
+//#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+//#define DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS
+//#endif // _MSC_VER
+//#if defined(__clang__) && __has_feature(cxx_defaulted_functions)
+//#define DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS
+//#endif // clang
+//#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __GNUC__ > 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+//#define DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS
+//#endif // __GNUC__
+//#endif // DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS
+//
+//#if defined(DOCTEST_CONFIG_NO_DEFAULTED_FUNCTIONS) && defined(DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS)
+//#undef DOCTEST_CONFIG_WITH_DEFAULTED_FUNCTIONS
+//#endif // DOCTEST_CONFIG_NO_DEFAULTED_FUNCTIONS