-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathbuffer.cpp
More file actions
79 lines (70 loc) · 2.07 KB
/
Copy pathbuffer.cpp
File metadata and controls
79 lines (70 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// Copyright (c) 2015-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Test that header file is self-contained
#include <nudb/detail/buffer.hpp>
#include "suite.hpp"
#include <boost/beast/_experimental/unit_test/suite.hpp>
#include <type_traits>
namespace nudb {
namespace test {
class buffer_test : public boost::beast::unit_test::suite
{
public:
void
run()
{
using buffer = nudb::detail::buffer;
static_assert(std::is_default_constructible<buffer>::value, "");
#if 0
static_assert(std::is_copy_constructible<buffer>::value, "");
static_assert(std::is_copy_assignable<buffer>::value, "");
#else
static_assert(! std::is_copy_constructible<buffer>::value, "");
static_assert(! std::is_copy_assignable<buffer>::value, "");
#endif
static_assert(std::is_move_constructible<buffer>::value, "");
static_assert(std::is_move_assignable<buffer>::value, "");
{
buffer b;
}
{
buffer b1(1024);
BEAST_EXPECT(b1.size() == 1024);
buffer b2(std::move(b1));
BEAST_EXPECT(b1.size() == 0);
BEAST_EXPECT(b2.size() == 1024);
}
{
buffer b1(1024);
BEAST_EXPECT(b1.size() == 1024);
buffer b2;
b2 = std::move(b1);
BEAST_EXPECT(b1.size() == 0);
BEAST_EXPECT(b2.size() == 1024);
}
#if 0
{
buffer b1(1024);
BEAST_EXPECT(b1.size() == 1024);
buffer b2(b1);
BEAST_EXPECT(b1.size() == 1024);
BEAST_EXPECT(b2.size() == 1024);
}
{
buffer b1(1024);
BEAST_EXPECT(b1.size() == 1024);
buffer b2;
b2 = b1;
BEAST_EXPECT(b1.size() == 1024);
BEAST_EXPECT(b2.size() == 1024);
}
#endif
}
};
DEFINE_TESTSUITE(nudb,test,buffer);
} // test
} // nudb