FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
custom_queue/queue_tests.cpp at master · zasekle/custom_queue · GitHub
zasekle
/
custom_queue
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
custom_queue
/
queue_tests.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
121 lines (90 loc) · 2.04 KB
Breadcrumbs
custom_queue
/
queue_tests.cpp
Copy path
File metadata and controls
121 lines (90 loc) · 2.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//
//
Created by jeremiah on 5/9/23.
//
#
include
<
cassert
>
#
include
"
queue_tests.h
"
#
include
"
custom_queue.h
"
void
TestSuite::empty_queue
() {
CustomQueue<
int
> q;
assert
(q.
empty
());
}
void
TestSuite::non_empty_queue
() {
CustomQueue<
int
> q;
q.
push
(
12
);
assert
(!q.
empty
());
}
void
TestSuite::front_when_empty
() {
CustomQueue<
int
> q;
auto
ret_val = q.
front
();
assert
(!ret_val.
get
());
}
void
TestSuite::front_with_elements
() {
CustomQueue<
int
> q;
q.
push
(
1
);
q.
push
(
2
);
auto
ret_val = q.
front
();
assert
(ret_val.
get
());
assert
(*ret_val ==
1
);
}
void
TestSuite::back_when_empty
() {
CustomQueue<
int
> q;
auto
ret_val = q.
back
();
assert
(!ret_val.
get
());
}
void
TestSuite::back_with_elements
() {
CustomQueue<
int
> q;
q.
push
(
1
);
q.
push
(
2
);
auto
ret_val = q.
back
();
assert
(ret_val.
get
());
assert
(*ret_val ==
2
);
}
void
TestSuite::push_to_empty_list
() {
CustomQueue<
int
> q;
q.
push
(
1
);
auto
back_val = q.
back
();
auto
front_val = q.
front
();
assert
(back_val.
get
());
assert
(front_val.
get
());
assert
(q.
size
() ==
1
);
assert
(*back_val ==
1
);
assert
(*front_val ==
1
);
}
void
TestSuite::push_to_list
() {
CustomQueue<
int
> q;
q.
push
(
1
);
q.
push
(
2
);
q.
push
(
3
);
auto
back_val = q.
back
();
auto
front_val = q.
front
();
assert
(back_val.
get
());
assert
(front_val.
get
());
assert
(q.
size
() ==
3
);
assert
(*back_val ==
3
);
assert
(*front_val ==
1
);
}
void
TestSuite::pop_from_empty_list
() {
CustomQueue<
int
> q;
auto
ret_val = q.
pop
();
assert
(!ret_val);
assert
(q.
size
() ==
0
);
}
void
TestSuite::pop_from_single_element
() {
CustomQueue<
int
> q;
q.
push
(
5
);
assert
(q.
size
() ==
1
);
auto
ret_val = q.
pop
();
assert
(ret_val.
get
());
assert
(q.
size
() ==
0
);
assert
(*ret_val ==
5
);
}
void
TestSuite::pop_from_list
() {
CustomQueue<
int
> q;
q.
push
(
5
);
q.
push
(
6
);
q.
push
(
7
);
auto
ret_val = q.
pop
();
assert
(ret_val.
get
());
assert
(q.
size
() ==
2
);
assert
(*ret_val ==
5
);
}
Back
|
FazBrowse Home
|
New Git URL