8e7ffafbaf
Further adjustments for simarm_x64. Flutter Gallery: ARM32 Instructions(CodeSize): 6979424 -> 6771856 (-2.97%) Total(CodeSize): 10855163 -> 10363319 (-4.53%) ARM64 Instructions(CodeSize): 7334368 -> 6817312 (-7.05%) Total(CodeSize): 11505069 -> 10771431 (-6.37%) Bug: https://github.com/dart-lang/sdk/issues/37103 Bug: https://github.com/dart-lang/sdk/issues/38452 Change-Id: I2bb44e7b2c002d53830b66cf4aedc4455c815326 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119440 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "vm/os.h"
|
|
#include "platform/assert.h"
|
|
#include "platform/utils.h"
|
|
#include "vm/globals.h"
|
|
#include "vm/unit_test.h"
|
|
|
|
namespace dart {
|
|
|
|
VM_UNIT_TEST_CASE(SNPrint) {
|
|
char buffer[256];
|
|
int length;
|
|
length = Utils::SNPrint(buffer, 10, "%s", "foo");
|
|
EXPECT_EQ(3, length);
|
|
EXPECT_STREQ("foo", buffer);
|
|
length = Utils::SNPrint(buffer, 3, "%s", "foo");
|
|
EXPECT_EQ(3, length);
|
|
EXPECT_STREQ("fo", buffer);
|
|
length = Utils::SNPrint(buffer, 256, "%s%c%d", "foo", 'Z', 42);
|
|
EXPECT_EQ(6, length);
|
|
EXPECT_STREQ("fooZ42", buffer);
|
|
length = Utils::SNPrint(NULL, 0, "foo");
|
|
EXPECT_EQ(3, length);
|
|
}
|
|
|
|
// This test is expected to crash when it runs.
|
|
VM_UNIT_TEST_CASE_WITH_EXPECTATION(SNPrint_BadArgs, "Crash") {
|
|
int width = kMaxInt32;
|
|
int num = 7;
|
|
Utils::SNPrint(NULL, 0, "%*d%*d", width, num, width, num);
|
|
}
|
|
|
|
VM_UNIT_TEST_CASE(OsFuncs) {
|
|
EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment()));
|
|
int procs = OS::NumberOfAvailableProcessors();
|
|
EXPECT_LE(1, procs);
|
|
}
|
|
|
|
} // namespace dart
|