forked from project-arcana/clean-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring_stream.cc
More file actions
39 lines (33 loc) · 821 Bytes
/
Copy pathstring_stream.cc
File metadata and controls
39 lines (33 loc) · 821 Bytes
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
#include <nexus/test.hh>
#include <clean-core/string_stream.hh>
TEST("cc::string_stream")
{
cc::string_stream ss;
CHECK(ss.empty());
ss << "";
CHECK(ss.empty());
ss << "foo";
CHECK(ss.size() == 3);
CHECK(ss.to_string() == "foo");
ss << "bar";
CHECK(ss.size() == 6);
CHECK(ss.to_string() == "foobar");
ss.clear();
CHECK(ss.empty());
cc::string_stream ss2;
ss2 = ss;
CHECK(ss.empty());
CHECK(ss2.empty());
ss << "foo";
ss2 = cc::move(ss);
CHECK(ss.empty());
CHECK(ss2.to_string() == "foo");
cc::string_stream ss3(ss2);
CHECK(ss3.to_string() == "foo");
cc::string_stream ss4(cc::move(ss2));
CHECK(ss4.to_string() == "foo");
CHECK(ss2.empty());
ss << "foo"
<< "bar";
CHECK(ss.to_string() == "foobar");
}