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
test_support.h
Go to the documentation of this file.
1// Copyright 2015 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#ifndef TESTING_TEST_SUPPORT_H_
6#define TESTING_TEST_SUPPORT_H_
7
8#include <stdint.h>
9
10#include "core/fxcrt/compiler_specific.h"
11#include "core/fxcrt/span.h"
12
13namespace pdfium {
14
15#define STR_IN_TEST_CASE(input_literal, ...)
16 {
17 reinterpret_cast<const uint8_t*>(input_literal),
18 sizeof(input_literal) - 1, __VA_ARGS__
19 }
20
21#define STR_IN_OUT_CASE(input_literal, expected_literal, ...)
22 {
23 reinterpret_cast<const uint8_t*>(input_literal),
24 sizeof(input_literal) - 1,
25 reinterpret_cast<const uint8_t*>(expected_literal),
26 sizeof(expected_literal) - 1, __VA_ARGS__
27 }
28
30 pdfium::span<const uint8_t> input_span() const {
31 // SAFETY: size determined from literal via macro above.
32 return UNSAFE_BUFFERS(pdfium::make_span(input, input_size));
33 }
34 pdfium::span<const uint8_t> expected_span() const {
35 // SAFETY: size determined from literal via macro above.
36 return UNSAFE_BUFFERS(pdfium::make_span(expected, expected_size));
37 }
38
39 const uint8_t* input;
40 uint32_t input_size;
41 const uint8_t* expected;
42 uint32_t expected_size;
43};
44
46 pdfium::span<const uint8_t> input_span() const {
47 // SAFETY: size determined from literal via macro above.
48 return UNSAFE_BUFFERS(pdfium::make_span(input, input_size));
49 }
50 pdfium::span<const uint8_t> expected_span() const {
51 // SAFETY: size determined from literal via macro above.
52 return UNSAFE_BUFFERS(pdfium::make_span(expected, expected_size));
53 }
54
55 const uint8_t* input;
56 uint32_t input_size;
57 const uint8_t* expected;
58 uint32_t expected_size;
59 // The size of input string being processed.
61};
62
64 const wchar_t* input;
65 const wchar_t* expected;
66};
67
68} // namespace pdfium
69
70#endif // TESTING_TEST_SUPPORT_H_
ByteStringView GetWord()
#define UNSAFE_BUFFERS(...)
TEST(FXCRYPT, MD5GenerateEmtpyData)
fxcrt::ByteStringView ByteStringView
pdfium::span< const uint8_t > expected_span() const
const uint8_t * input
pdfium::span< const uint8_t > input_span() const
const uint8_t * expected
pdfium::span< const uint8_t > input_span() const
pdfium::span< const uint8_t > expected_span() const
const uint8_t * expected
const uint8_t * input
#define STR_IN_OUT_CASE(input_literal, expected_literal,...)