Files
sdk/runtime/vm/os_test.cc
T
Ryan Macnak 1dc4277e5b [vm] Remove dead code.
TEST=ci
Change-Id: Ic162deea4a39869a158726616e5c8dc0ff058817
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475781
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-01-27 09:14:39 -08:00

34 lines
950 B
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(nullptr, 0, "foo");
EXPECT_EQ(3, length);
}
VM_UNIT_TEST_CASE(OsFuncs) {
EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment()));
}
} // namespace dart