1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2015, 2018 - TortoiseGit
4 // Copyright (C) 2010 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "UniqueQueue.h"
24 TEST(UniqueQueue
, CString
)
26 UniqueQueue
<CString
> myQueue
;
27 EXPECT_EQ(0U, myQueue
.size());
28 EXPECT_TRUE(myQueue
.Pop().IsEmpty());
29 EXPECT_EQ(0U, myQueue
.erase(L
"doesnotexist"));
30 myQueue
.Push(CString(L
"one"));
31 EXPECT_EQ(1U, myQueue
.size());
32 myQueue
.Push(CString(L
"two"));
33 EXPECT_EQ(2U, myQueue
.size());
34 myQueue
.Push(CString(L
"one"));
35 EXPECT_EQ(2U, myQueue
.size());
36 myQueue
.Push(CString(L
"three"));
37 EXPECT_EQ(3U, myQueue
.size());
38 EXPECT_EQ(3U, myQueue
.erase(L
"doesnotexist"));
39 myQueue
.Push(CString(L
"three"));
40 EXPECT_EQ(3U, myQueue
.size());
41 EXPECT_EQ(2U, myQueue
.erase(CString(L
"three")));
42 EXPECT_EQ(2U, myQueue
.size());
43 myQueue
.Push(CString(L
"three"));
44 EXPECT_EQ(3U, myQueue
.size());
46 EXPECT_TRUE(myQueue
.Pop().Compare(L
"two") == 0);
47 EXPECT_EQ(2U, myQueue
.size());
48 EXPECT_TRUE(myQueue
.Pop().Compare(L
"one") == 0);
49 EXPECT_EQ(1U, myQueue
.size());
50 EXPECT_TRUE(myQueue
.Pop().Compare(L
"three") == 0);
51 EXPECT_EQ(0U, myQueue
.size());
52 EXPECT_TRUE(myQueue
.Pop().IsEmpty());