Added tests for xxx.size() and xxx.empty() for all the sequence containers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318244 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
46
test/std/containers/sequences/vector.bool/empty.pass.cpp
Normal file
46
test/std/containers/sequences/vector.bool/empty.pass.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <vector>
|
||||
|
||||
// class vector
|
||||
|
||||
// bool empty() const noexcept;
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::vector<bool> C;
|
||||
C c;
|
||||
ASSERT_NOEXCEPT(c.empty());
|
||||
assert(c.empty());
|
||||
c.push_back(false);
|
||||
assert(!c.empty());
|
||||
c.clear();
|
||||
assert(c.empty());
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
typedef std::vector<bool, min_allocator<bool>> C;
|
||||
C c;
|
||||
ASSERT_NOEXCEPT(c.empty());
|
||||
assert(c.empty());
|
||||
c.push_back(false);
|
||||
assert(!c.empty());
|
||||
c.clear();
|
||||
assert(c.empty());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user