Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2018-08-17Fix #717 - Add empty() to strided_span (#718)Stephan Dollberg
2018-08-13Dev/annagrin/sloppy not null (#712)Anna Gringauze
* Added c++17 test configurations for clang5.0 and clang6.0 * added transition helper sloppy_not_null * Moved gsl_transition to a samples folder * Fixed build break and static analysis warnings
2018-08-13Dev/annagrin/make not null (#711)Anna Gringauze
* Added c++17 test configurations for clang5.0 and clang6.0 * Added make_not_null helper to create a not_null Introduction of explicit not_null constructor made it cumbersome to create not_nulls in c++14. Adding make_not_null helper. Usage (see tests): int i = 42; auto x = make_not_null(&i); helper(make_not_null(&i)); helper_const(make_not_null(&i)); * Added std::forward to make_not_null, fixed some code analysis warnings * Fix build break in VS2015 Release configuration * Fix build break in VS2015 Release configuration
2018-08-13fix cppcorecheck warnings (#703)Anna Gringauze
* Added c++17 test configurations for clang5.0 and clang6.0 * Fixed CppCoreCheck warnings in GSL and tests - Added CMakeSettings.json for VS Open Folder configuration - So we can easily run CppCoreCheck in VS - Fixed CppCorecheck warnings where it made sense - Suppressed the rest - Some suppression does not work due to compiler/tool bugs, so replaced by #pragma disable - CppCoreCheck has noise, suppressed those with comments - Catch produces many warnings, blanket-supressed them all - Had to fix clang formatting to keep attributes in place - clang-format does not support attributes, so I am using - "CommentPragmas: '^ NO-FORMAT:'" to skip formatiting on them - Removed GSL_NOEXCEPT macro, removed incorred noexcepts * Ignore unknown attributes * ignore unknown attributes in noexception mode tests * fixed C26472 in at() * created GSL_SUPPRESS macro to allow all compilers to parse suppression attributes * try to fix gcc compilation problems with attributes * ignore gsl::suppress for gcc * move suppression to function level on return statements clang5.0 and up does not allow attributes on return statemets in constexpr functions * move suppression to function level on return statements * use GSL_SUPPRESS in algorithm_tests * Addressed PR comments
2018-07-14Test broken size (#704)Daniel599
* added test for size check (#590) * added #if for gcc 6.4 bug (#590) * hopefully fix #if for gcc 6.4 bug (#590) * fixed CHECK usage (#590) * gcc broken size bug is only when using optimizations
2018-06-15Added testing for c++17 to latest compilers with test with (#692)Anna Gringauze
* Added testing with std=c++17 for latest compilers Added running latest compilers with -std=c++17 option to CI the test matrix, Updated cmake configuration to allow passing c++ standard on the command line. * attempt to fix appveyor break * added clang6.0, removed c++17 tests for clang 5.0 * commented out tests for clang with c++17 die to issue #695 * Addresed comments
2018-06-07Added template argument deduction for not_null (#689)Anna Gringauze
* Added template argument deduction for not_null This allows compilers with c++17 support to infer template instantiation types when calling not_null constructor: int foo(not_null<const int*> x); int main() { int t = 0; not_null x{ &t }; return foo(not_null{ &t }); } * replaced deduction guides by a simple constructor * Updated tests * fixed check for availability of std::byte * testing c++1z on clang * fixed cmakelists extra endif * include cstddef header for clang and gcc in pointers * fixed a typo * fix missing nullptr_t type * fixed typo in CMakeLists.tst * change approach to c++17 testing, step one: revert cmake testing, update clang5.0 package removed using latest c++ due to clang5.0 failing, update clang5.0 travis config to use llvm-toolchain-trusty-5.0 * addressed comments
2018-05-29Add as_bytes for basic_string_span, fixes issue #655 (#683)beinhaerter
2018-04-25not_null constructor is now explicit (#659)ericLemanissier
solves #395
2018-03-16Enable usage of gsl::narrow with exceptions disabled (#640)v1.0.0Anna Gringauze
* Enable usage of gsl::narrow with exceptions disabled This solution uses the approach of boost::asio to enabling usage of the library in environments where exception usage is either prohibited or not feasible (due to code size constraints). A function template gsl::throw_exception has been added, which in a normal environment just throws the exception. However, when GSL_TERMINATE_ON_CONTRACT_VIOLATION is defined the function is only declared by gsl and the definition of this function template must be supplied by the library's user. Closes: #468 Signed-off-by: Damian Jarek <damian.jarek93@gmail.com> Addition: - understand STL no exception macro - use function static variable to set termination handler in kernel mode - add compile-only tests for no-exception mode * added termination tests and fixed bugs * disabled warning C4577 for msvc 2015
2018-03-04Fix return type of templated span.subspan() (#625)Neil MacIntosh
* Added support for returning fixed-spize spans from subspan(). * Addressed issues from code review. * Took simpler approach to static data member. * Subtle fix to support MSVC 15. * Helps to not introduce extraneous >
2018-03-04make explicit not_null move constructor so it is noexcept (#630)Zac Hansen
* make explicit not_null move constructor so it is noexcept * added test for not_null being noexcet move constructible
2018-02-22add gsl::index typedef (#620)paweldac
* rename index in multi_span to span_index gsl::index is name reserved for different type * add gsl::index typedef cppcoreguidelines referece: ES.107: Don't use unsigned for subscripts, prefer gsl::index https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Res-subscripts * rename span_index to multi_span_index
2018-02-12add throw on nullptr CTOR test (#577)menete
2018-02-11Removed span from-nullptr_t ctor.Neil MacIntosh
2018-02-11Removed span.length() as synonym for span.size().Neil MacIntosh
2018-02-11Removed from-smart-ptr constructors.Neil MacIntosh
2017-11-28Applied iwyu --comment to the code base (#588)Tiago
2017-11-14Updates catch to version 2.0 (#580)Tiago
Catch 1 would capture exceptions by value and depending on your clang config could lead to errors/warnings.
2017-11-14Iosfwd (#586)menete
* Solves #567 with <iosfwd> approach * adds a little testing to not_null ostream
2017-10-31Move GSL pointers to a separate header (#566)Tiago
2017-10-31additional span tests (pointer length constructor) (#568)menete
2017-10-19Revert inadvertent addition of tests/unittest-cpp submodule from #561 (#562)Casey Carter
2017-10-19Update std::byte detection in gsl_byte for MSVC (#561)Casey Carter
* Only check that `_HAS_STD_BYTE` is defined to a non-zero value
2017-09-19Made string_span details::string_length() generic (Fix issue #542) (#543)Galik
* Made string_span details::string_length() generic removed overloads & specialized classes Creating string_spans using `char16_t` and `char32_t` was not possible without creating new specializations and function overloads. This patch makes details::string_length() generic removing the need to extend the overloads and specializations. * added type aliases for string_span types char16_t and char32_t * Added char16_t & char32_t overloads for ensure_z * added string_span tests for char16_T & char32_t * added zstring type aliases for char16_t & char32_t * Added tests for char16_t & char31_t zstring and string_span types * applies clang format to <gsl/string_span> * Clang format tests/string_span_tests.cpp * Removed ensure_z() overloads as they don't add functionality.
2017-09-07correct spelling mistake (#554)Edward Betts
2017-08-17Allow to use system version of the catch test framework (#549)Nicholas Guriev
2017-08-17Fix catch installation issue (#540)Tiago
Catch was being installed to the root of the cmake project. This violated the source code tree itself and would not work at all if GSL was being consumed with add_subdirectory. CMake will now install catch to the build tree under /dependencies.
2017-07-13Move from unittest-cpp to catch for unit testing. (#533)Neil MacIntosh
Many thanks to @rianquinn. This should fix #495, #494 and #529.
2017-05-31Fixes dereferencing operator issue #517 introduced in PR #513 (#516)Alexey Malov
* Fixes issue with dereferencing operator issue #491 introduced in PR #513 dereferencing operator added in PR#513 returned a copy of the object instead of reference to it. Adding decltype(auto) as return type of operator* fixes this issue. * added more tests for not_null::operator*
2017-05-31Restricting usage of owner<T> to pointer types (#507)saurabh singh
* Restricting usage of owner<T> to pointer types * Removing an additional type that was created for testing * Added comment about the new constraint on owner * Adding dereference operator to not_null * Removing dereference operator changes for not-null * Removing dereference operator changes for not-null * Review comments
2017-05-30Adding derference operator to not_null (#513)saurabh singh
2017-04-26Update CMake usage (#493)Tiago
* Refactor cmake file to have GSL as an interface CMake supports header only libraries as INTERFACE libraries. Using interfaces libraries make is easier for users to use the library because one just need to "link" agaisnt the library and necessary include paths, definitions, flags... will be taken care of. This commit creates a new interface library called GSL. It then add the following things to the GSL library: - compiler flags ex: (-std=c++14) - definitions ex: _SCL_SECURE_NO_WARNINGS - include paths ex: include/gsl - natvis file Another project can now have the GSL project as a git submodule and one only need to add the two following lines to their project to use the GSL. add_subdirectory(GSL) target_link_libraries(<some target> GSL) After cmake 3.8.0 a lot of the logic can be simplified. Right now the cmake file has an if for version checking, but when the minimun required version is 3.8.0 one can just delete the branching and keep the simpler version. * Cut support for c++11 Compiling on GCC6.2 with only the c++11 flag will generate compilation errors. For example some of the errors are related to the use of enable_if_t which is a c++14 feature. To avoid compilation errors this comiit removes c++11 support on linux. * Refactor code that pulls unittest-cpp Two minor changes: - uses cmake to find a proper installation of git (in case user does not have it on the path) - checks for the CMakeLists file instead. This is needed for the build itself and seems like a better way to do the checking * Refactor tests so they show together on VS This commit will make a VS geenrated project to group all tests under GSL_tests * Refactor tests configuration This creates a test configuration interface and add all the previous compiler options to that interface. compiler options are now sorted so it is easier to find them, and also one per line, so that modifications are easier to track from git.
2017-04-20Reformat files to follow clang-format style (#492)Tiago
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.
2017-04-17Turn warnings into errors (#488)Casey Carter
2017-04-13Updated submodule reference for unittest-cpp to latest (#483)Julien Monat Rodier
- updated to latest unittest-cpp
2017-04-13Added support of not_null<smart_ptr> comparison (#473)Alexey Malov
* Added support of not_null<smart_ptr> comparison * The return type of not_null comparison operators is determined using SFINAE #474 * tests for gsl::not_null comparison were added * not_null comparison tests were rewritten to compare pointers to objects located in the same array * not_null<shared_ptr> comparison was simplified
2017-04-04gsl::at clean-up: (#479)Casey Carter
* initializer_list overload returns by value to avoid lifetime issues * generic overload uses expression SFINAE to work with any type that has member size() and operator[], which notably includes const/non-const vector and array. * Add test coverage for const objects, rvalue initializer_lists, and constexpr usage. Fixes #357.
2017-04-02Fix some corechecker warnings (#470)MikeGitb
* Improve const correctness in string_span * Improve const correctness in bounds_tests.cpp and byte_tests.cpp * Improve const correctness in span_tests.cpp * Improve const correctness in utils_tests.cpp * Use gsl::owner for dynamically allocated memory in string_span_tests.cpp * Improve const correctness in string_span_tests.cpp * Improve const correctness for strided_span_tests.cpp
2017-02-13Properly qualify std::size_t (#448)Casey Carter
2017-02-13Silence warning in algorithm_tests with VS2017 (#453)Casey Carter
Now that the STL respects /W4, this test that uses std::copy_n to copy a span of ints to a span of chars triggers "warning C4244: '=': conversion from 'int' to 'char', possible loss of data". Switch the source & destination spans to short and int to maintain the test's cross-type nature but without narrowing.
2017-02-08Cleanup include structure, constexpr and noexcept compiler workarounds.Casey Carter
* Nest "gsl" directory inside a new "include" directory. * Cleanup the _MSC_VER conditionals a bit; use constexpr on VS2017+. * Don't #define noexcept on non-Microsoft implementations. * Workaround VS2017 bug in multi_span. (Also implement == and != for static_bounds_dynamic_range_t because I'm an EoP semantic soundness snob.) Fixes #441.
2017-01-28Make is_default_constructible work for spans.Casey Carter
2016-11-30Fix a signed/unsigned comparison warning. David Doria
2016-11-17Add a copy() function for span.MikeGitb
2016-11-16Add make_span()Rian Quinn
This patch provides a make_span function to simplify the creation of spans until C++17 is available. In addition this patch updates the unit tests to includes tests that verify this new functionality.
2016-11-16Fix template pack expansion bug in multi_span.Neil MacIntosh
* Fix issue #333 by moving a parenthesis. * Added test to prove fix is good.
2016-11-16Cleanup compiler warningsRian Quinn
The unique_ptr / shared_ptr patch introduced a compiler warning. This corrects that issue.
2016-11-05Fixed compile flags for tests when using MSVC. Neil MacIntosh
2016-11-04Add span construction from unique_ptr and shared_ptr Rian Quinn
This patch adds support for std::unique_ptr and std::shared_ptr to the gsl::span class instead of having to manually grab the pointer via get(). For reference, this is part of the following issue: https://github.com/Microsoft/GSL/issues/402