Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
11namespace dart {
12
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
32 EXPECT_LE(1, procs);
33}
34
35} // namespace dart
#define EXPECT(type, expectedAlignment, expectedSize)
static int NumberOfAvailableProcessors()
static intptr_t ActivationFrameAlignment()
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
static constexpr bool IsPowerOfTwo(T x)
Definition utils.h:61
static const uint8_t buffer[]
size_t length
#define VM_UNIT_TEST_CASE(name)
Definition unit_test.h:33