mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 21:09:40 +00:00
d8e96a8700
This test was skipped for ages and it does not seem to be very useful. Closes https://github.com/dart-lang/sdk/issues/5133. Change-Id: I9035956069fc7d42e710c3c49f98811db10f7d36 Reviewed-on: https://dart-review.googlesource.com/46062 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
44 lines
1.2 KiB
C++
44 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(SNPrint_BadArgs) {
|
|
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()));
|
|
EXPECT(Utils::IsPowerOfTwo(OS::PreferredCodeAlignment()));
|
|
int procs = OS::NumberOfAvailableProcessors();
|
|
EXPECT_LE(1, procs);
|
|
}
|
|
|
|
} // namespace dart
|