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
autonuller_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2020 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/autonuller.h"
6
#
include
"core/fxcrt/unowned_ptr.h"
7
#
include
"testing/gtest/include/gtest/gtest.h"
8
9
TEST
(fxcrt, AutoNuller) {
10
int
x = 5;
11
int
* ptr;
12
{
13
AutoNuller<
int
*> nuller(&ptr);
14
ptr = &x;
15
EXPECT_EQ(&x, ptr);
16
}
17
EXPECT_FALSE(ptr);
18
}
19
20
TEST
(fxcrt, AutoNullerAbandon) {
21
int
x = 5;
22
int
* ptr;
23
{
24
AutoNuller<
int
*> nuller(&ptr);
25
ptr = &x;
26
EXPECT_EQ(&x, ptr);
27
nuller.AbandonNullification();
28
}
29
EXPECT_EQ(&x, ptr);
30
}
31
32
TEST
(fxcrt, AutoNullerUnownedPtr) {
33
int
x = 5;
34
UnownedPtr<
int
> ptr;
35
{
36
AutoNuller<UnownedPtr<
int
>> nuller(&ptr);
37
ptr = &x;
38
EXPECT_EQ(&x, ptr);
39
}
40
EXPECT_FALSE(ptr);
41
}
42
43
TEST
(fxcrt, AutoNullerUnownedPtrAbandon) {
44
int
x = 5;
45
UnownedPtr<
int
> ptr;
46
{
47
AutoNuller<UnownedPtr<
int
>> nuller(&ptr);
48
ptr = &x;
49
EXPECT_EQ(&x, ptr);
50
nuller.AbandonNullification();
51
}
52
EXPECT_EQ(&x, ptr);
53
}
TEST
TEST(FXCRYPT, CryptToBase16)
Definition
fx_crypt_unittest.cpp:34
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
autonuller_unittest.cpp
Generated on Sat Sep 21 2024 00:54:54 for Qt by
1.12.0