#ifdef UNSAFE_BUFFERS_BUILD
#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"
#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
}
TEST(SafeSPrintfTest, Truncation) { … }
TEST(SafeSPrintfTest, Padding) { … }
TEST(SafeSPrintfTest, EmbeddedNul) { … }
TEST(SafeSPrintfTest, EmitNULL) { … }
TEST(SafeSPrintfTest, PointerSize) { … }
}
}