Skip to content

Commit 9fbc3ad

Browse files
committed
trivial test
1 parent bfeacbb commit 9fbc3ad

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

test/vector.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "vector.h"
2+
#include <list>
23
USING_NS_STD;
34
USING_NS_ELLOOP;
45
TEST(VectorTest, DeleteItem) {
@@ -11,7 +12,23 @@ TEST(VectorTest, DeleteItem) {
1112
}
1213
print_container(vi);
1314

15+
list<int> li{ 5, 6, 7, 8, 9 };
16+
print_container(li);
17+
vi.assign(li.begin(), li.end());
18+
print_container(vi);
19+
1420
// question:
1521
// can i do vector.assign() directly without deleting content first(such as swap())?
1622

23+
24+
25+
}
26+
27+
TEST(OtherTest, UnInitialClassMember) {
28+
UnInitial ui;
29+
psln(ui.i_);
30+
cout << boolalpha << ui.b_ << endl;
31+
cout << noboolalpha << ui.b_ << endl;
32+
cout << noboolalpha << ui.c_ << endl;
33+
cout << noboolalpha << ui.d_ << endl;
1734
}

test/vector.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
#include <vector>
2-
#include "inc.h"
2+
#include "inc.h"
3+
4+
class UnInitial {
5+
public:
6+
UnInitial(int i = 0) : i_(i) {
7+
8+
}
9+
bool b_;
10+
int d_;
11+
bool c_;
12+
int i_;
13+
};

0 commit comments

Comments
 (0)