Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
stl_util_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2024 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#
include
"core/fxcrt/stl_util.h"
6
7
#
include
<
stdint
.
h
>
8
9
#
include
<
array
>
10
#
include
<
vector
>
11
12
#
include
"core/fxcrt/span.h"
13
#
include
"testing/gtest/include/gtest/gtest.h"
14
15
TEST
(fxcrt, FillCArray) {
16
uint32_t buf[4];
17
fxcrt::Fill(buf, 0x01020304u);
18
for
(
const
auto
b : buf) {
19
EXPECT_EQ(b, 0x01020304u);
20
}
21
}
22
23
TEST
(fxcrt, FillStdArray) {
24
std::array<uint16_t, 10> buf;
25
fxcrt::Fill(buf, 0x0102u);
26
for
(
const
auto
b : buf) {
27
EXPECT_EQ(b, 0x0102u);
28
}
29
}
30
31
TEST
(fxcrt, FillStdVector) {
32
std::vector<uint8_t> buf(15);
33
fxcrt::Fill(buf, 0x32u);
34
for
(
const
auto
b : buf) {
35
EXPECT_EQ(b, 0x32u);
36
}
37
}
38
39
TEST
(fxcrt, FillSpan) {
40
float
buf[12];
41
auto
buf_span = pdfium::make_span(buf);
42
fxcrt::Fill(buf_span, 123.0f);
43
for
(
const
auto
b : buf) {
44
EXPECT_EQ(b, 123.0f);
45
}
46
}
47
48
TEST
(fxcrt, CopyCArray) {
49
uint32_t dst[4];
50
{
51
uint32_t buf[4];
52
fxcrt::Fill(buf, 0x01020304u);
53
fxcrt::Copy(buf, dst);
54
}
55
for
(
const
auto
b : dst) {
56
EXPECT_EQ(b, 0x01020304u);
57
}
58
}
59
60
TEST
(fxcrt, CopyStdArray) {
61
uint16_t dst[10];
62
{
63
std::array<uint16_t, 10> buf;
64
fxcrt::Fill(buf, 0x0102u);
65
fxcrt::Copy(buf, dst);
66
}
67
for
(
const
auto
b : dst) {
68
EXPECT_EQ(b, 0x0102u);
69
}
70
}
71
72
TEST
(fxcrt, CopyStdVector) {
73
uint8_t dst[15];
74
{
75
std::vector<uint8_t> buf(15);
76
fxcrt::Fill(buf, 0x32u);
77
fxcrt::Copy(buf, dst);
78
}
79
for
(
const
auto
b : dst) {
80
EXPECT_EQ(b, 0x32u);
81
}
82
}
83
84
TEST
(fxcrt, CopySpan) {
85
float
dst[12];
86
{
87
float
buf[12];
88
auto
buf_span = pdfium::make_span(buf);
89
fxcrt::Fill(buf_span, 123.0f);
90
fxcrt::Copy(buf_span, dst);
91
}
92
for
(
const
auto
b : dst) {
93
EXPECT_EQ(b, 123.0f);
94
}
95
}
TEST
TEST(FXCRYPT, CryptToBase16)
Definition
fx_crypt_unittest.cpp:39
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
stl_util_unittest.cpp
Generated on
for Qt by
1.14.0