Flutter Engine
The Flutter Engine
Classes | Functions | Variables
MD5Test.cpp File Reference
#include "src/core/SkMD5.h"
#include "tests/Test.h"
#include <array>
#include <cstddef>
#include <cstdint>
#include <cstring>

Go to the source code of this file.

Classes

struct  MD5Test
 

Functions

static bool digests_equal (const SkMD5::Digest &expectedDigest, const SkMD5::Digest &computedDigest)
 
static void md5_test (const char *string, const SkMD5::Digest &expectedDigest, skiatest::Reporter *reporter)
 
 DEF_TEST (MD5, reporter)
 

Variables

static struct MD5Test md5_tests []
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( MD5  ,
reporter   
)

Definition at line 65 of file MD5Test.cpp.

65 {
66 for (size_t i = 0; i < std::size(md5_tests); ++i) {
68 }
69}
reporter
Definition: FontMgrTest.cpp:39
static void md5_test(const char *string, const SkMD5::Digest &expectedDigest, skiatest::Reporter *reporter)
Definition: MD5Test.cpp:25
static struct MD5Test md5_tests[]
Win32Message message
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ digests_equal()

static bool digests_equal ( const SkMD5::Digest expectedDigest,
const SkMD5::Digest computedDigest 
)
static

Definition at line 16 of file MD5Test.cpp.

16 {
17 for (size_t i = 0; i < std::size(expectedDigest.data); ++i) {
18 if (expectedDigest.data[i] != computedDigest.data[i]) {
19 return false;
20 }
21 }
22 return true;
23}
uint8_t data[16]
Definition: SkMD5.h:39

◆ md5_test()

static void md5_test ( const char *  string,
const SkMD5::Digest expectedDigest,
skiatest::Reporter reporter 
)
static

Definition at line 25 of file MD5Test.cpp.

25 {
26 size_t len = strlen(string);
27
28 // All at once
29 {
30 SkMD5 context;
31 context.write(string, len);
32 SkMD5::Digest digest = context.finish();
33
34 REPORTER_ASSERT(reporter, digests_equal(expectedDigest, digest));
35 }
36
37 // One byte at a time.
38 {
39 SkMD5 context;
40 const uint8_t* data = reinterpret_cast<const uint8_t*>(string);
41 const uint8_t* end = reinterpret_cast<const uint8_t*>(string + len);
42 for (; data < end; ++data) {
43 context.write(data, 1);
44 }
45 SkMD5::Digest digest = context.finish();
46
47 REPORTER_ASSERT(reporter, digests_equal(expectedDigest, digest));
48 }
49}
static bool digests_equal(const SkMD5::Digest &expectedDigest, const SkMD5::Digest &computedDigest)
Definition: MD5Test.cpp:16
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
Definition: SkMD5.h:19
bool write(const void *buffer, size_t size) final
Definition: SkMD5.cpp:42
Digest finish()
Definition: SkMD5.cpp:72
glong glong end
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

Variable Documentation

◆ md5_tests

struct MD5Test md5_tests[]
static
Initial value:
= {
{ "", {{ 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e }} },
{ "a", {{ 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8, 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 }} },
{ "abc", {{ 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 }} },
{ "message digest", {{ 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d, 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 }} },
{ "abcdefghijklmnopqrstuvwxyz", {{ 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00, 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b }} },
{ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", {{ 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5, 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f }} },
{ "12345678901234567890123456789012345678901234567890123456789012345678901234567890", {{ 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a }} },
}