FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
co-cpp19/src/array19.lib/array19/Array.test.cpp at develop · basicpp/co-cpp19 · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
basicpp
/
co-cpp19
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
14
Code
Issues
1
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
co-cpp19
/
src
/
array19.lib
/
array19
/
Array.test.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (32 loc) · 819 Bytes
Breadcrumbs
co-cpp19
/
src
/
array19.lib
/
array19
/
Array.test.cpp
Copy path
File metadata and controls
41 lines (32 loc) · 819 Bytes
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
#
include
"
Array.h
"
using
namespace
array19
;
void
constexpr_Array_test
() {
constexpr
auto
a = Array{
1
,
2
,
3
};
static_assert
(a.
count
==
3
);
static_assert
(a[
1
] ==
2
);
constexpr
auto
s = [&] {
auto
s =
0
;
for
(
auto
v : a) s += v;
return
s;
}();
static_assert
(s ==
6
);
}
void
empty_Array_test
() {
constexpr
auto
a = Array<
int
,
0
>{};
static_assert
(a.
count
==
0
);
static_assert
(a.
isEmpty
());
constexpr
auto
s = [&] {
auto
s =
0
;
for
(
auto
v : a) s += v;
return
s;
}();
static_assert
(s ==
0
);
}
void
mutable_Array_test
() {
constexpr
auto
ca = [] {
auto
a = Array{
1
,
2
,
3
};
a.
amend
()[
1
] =
5
;
return
a;
}();
static_assert
(ca == Array{
1
,
5
,
3
});
}
Back
|
FazBrowse Home
|
New Git URL