Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
dart-lang
sdk
runtime
vm
os_test.cc
Go to the documentation of this file.
1
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2
// for details. All rights reserved. Use of this source code is governed by a
3
// BSD-style license that can be found in the LICENSE file.
4
5
#include "
vm/os.h
"
6
#include "
platform/assert.h
"
7
#include "
platform/utils.h
"
8
#include "
vm/globals.h
"
9
#include "
vm/unit_test.h
"
10
11
namespace
dart
{
12
13
VM_UNIT_TEST_CASE
(SNPrint) {
14
char
buffer
[256];
15
int
length
;
16
length
=
Utils::SNPrint
(
buffer
, 10,
"%s"
,
"foo"
);
17
EXPECT_EQ(3,
length
);
18
EXPECT_STREQ(
"foo"
,
buffer
);
19
length
=
Utils::SNPrint
(
buffer
, 3,
"%s"
,
"foo"
);
20
EXPECT_EQ(3,
length
);
21
EXPECT_STREQ(
"fo"
,
buffer
);
22
length
=
Utils::SNPrint
(
buffer
, 256,
"%s%c%d"
,
"foo"
,
'Z'
, 42);
23
EXPECT_EQ(6,
length
);
24
EXPECT_STREQ(
"fooZ42"
,
buffer
);
25
length
=
Utils::SNPrint
(
nullptr
, 0,
"foo"
);
26
EXPECT_EQ(3,
length
);
27
}
28
29
VM_UNIT_TEST_CASE
(OsFuncs) {
30
EXPECT
(
Utils::IsPowerOfTwo
(
OS::ActivationFrameAlignment
()));
31
int
procs =
OS::NumberOfAvailableProcessors
();
32
EXPECT_LE(1, procs);
33
}
34
35
}
// namespace dart
EXPECT
#define EXPECT(type, expectedAlignment, expectedSize)
Definition
UniformOffsetCalculatorTest.cpp:33
assert.h
dart::OS::NumberOfAvailableProcessors
static int NumberOfAvailableProcessors()
dart::OS::ActivationFrameAlignment
static intptr_t ActivationFrameAlignment()
dart::Utils::SNPrint
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
dart::Utils::IsPowerOfTwo
static constexpr bool IsPowerOfTwo(T x)
Definition
utils.h:61
buffer
static const uint8_t buffer[]
Definition
fl_pixel_buffer_texture_test.cc:44
length
size_t length
Definition
key_event_handler.cc:41
dart
Definition
dart_vm.cc:33
os.h
utils.h
unit_test.h
VM_UNIT_TEST_CASE
#define VM_UNIT_TEST_CASE(name)
Definition
unit_test.h:33
globals.h
Generated on Fri Apr 26 2024 06:15:15 for Flutter Engine by
1.9.8