mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
66 lines
2.0 KiB
C++
66 lines
2.0 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
|
//
|
|
// This code is licensed under the MIT License (MIT).
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
// THE SOFTWARE.
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
#include <catch/catch.hpp> // for AssertionHandler, StringRef, CHECK, TEST_...
|
|
|
|
#include <gsl/gsl_byte> // for byte
|
|
#include <gsl/gsl_util> // for narrow_cast, at
|
|
#include <gsl/span> // for span, span_iterator, operator==, operator!=
|
|
|
|
#include <array> // for array
|
|
#include <iostream> // for ptrdiff_t
|
|
#include <iterator> // for reverse_iterator, operator-, operator==
|
|
#include <memory> // for unique_ptr, shared_ptr, make_unique, allo...
|
|
#include <regex> // for match_results, sub_match, match_results<>...
|
|
#include <stddef.h> // for ptrdiff_t
|
|
#include <string> // for string
|
|
#include <type_traits> // for integral_constant<>::value, is_default_co...
|
|
#include <vector> // for vector
|
|
|
|
namespace gsl {
|
|
struct fail_fast;
|
|
} // namespace gsl
|
|
|
|
using namespace std;
|
|
using namespace gsl;
|
|
|
|
namespace
|
|
{
|
|
struct BaseClass
|
|
{
|
|
};
|
|
struct DerivedClass : BaseClass
|
|
{
|
|
};
|
|
struct AddressOverloaded
|
|
{
|
|
AddressOverloaded operator&() const { return {}; }
|
|
};
|
|
}
|
|
|
|
GSL_SUPPRESS(con.4) // NO-FORMAT: attribute
|
|
TEST_CASE("default_constructor")
|
|
{
|
|
{
|
|
span<int> s;
|
|
CHECK((s.size() == 0 && s.data() == nullptr));
|
|
|
|
span<const int> cs;
|
|
CHECK((cs.size() == 0 && cs.data() == nullptr));
|
|
}
|
|
}
|