chromium/base/strings/safe_sprintf_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "base/strings/safe_sprintf.h"

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>

#include <limits>
#include <memory>

#include "base/check_op.h"
#include "base/types/fixed_array.h"
#include "build/build_config.h"
#include "partition_alloc/partition_alloc_config.h"
#include "testing/gtest/include/gtest/gtest.h"

// Death tests on Android are currently very flaky. No need to add more flaky
// tests, as they just make it hard to spot real problems.
// TODO(markus): See if the restrictions on Android can eventually be lifted.
#if defined(GTEST_HAS_DEATH_TEST) && !BUILDFLAG(IS_ANDROID)
#define ALLOW_DEATH_TEST
#endif

namespace base {
namespace strings {

TEST(SafeSPrintfTest, Empty) {}

TEST(SafeSPrintfTest, NoArguments) {}

TEST(SafeSPrintfTest, OneArgument) {}

TEST(SafeSPrintfTest, MissingArg) {}

TEST(SafeSPrintfTest, ASANFriendlyBufferTest) {}

TEST(SafeSPrintfTest, NArgs) {}

TEST(SafeSPrintfTest, DataTypes) {}

namespace {
void PrintLongString(char* buf, size_t sz) {}

#if !defined(NDEBUG)
class ScopedSafeSPrintfSSizeMaxSetter {};
#endif

}  // anonymous namespace

TEST(SafeSPrintfTest, Truncation) {}

TEST(SafeSPrintfTest, Padding) {}

TEST(SafeSPrintfTest, EmbeddedNul) {}

TEST(SafeSPrintfTest, EmitNULL) {}

TEST(SafeSPrintfTest, PointerSize) {}

}  // namespace strings
}  // namespace base