Cleanup
This commit is contained in:
parent
822222181b
commit
d8ef8a9e9b
@ -24,7 +24,7 @@
|
|||||||
# define FMT_HAS_FEATURE(x) 0
|
# define FMT_HAS_FEATURE(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__has_include)
|
#ifdef __has_include
|
||||||
# define FMT_HAS_INCLUDE(x) __has_include(x)
|
# define FMT_HAS_INCLUDE(x) __has_include(x)
|
||||||
#else
|
#else
|
||||||
# define FMT_HAS_INCLUDE(x) 0
|
# define FMT_HAS_INCLUDE(x) 0
|
||||||
@ -36,7 +36,7 @@
|
|||||||
# define FMT_GCC_VERSION 0
|
# define FMT_GCC_VERSION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__
|
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||||
# define FMT_HAS_GXX_CXX11 FMT_GCC_VERSION
|
# define FMT_HAS_GXX_CXX11 FMT_GCC_VERSION
|
||||||
#else
|
#else
|
||||||
# define FMT_HAS_GXX_CXX11 0
|
# define FMT_HAS_GXX_CXX11 0
|
||||||
@ -82,8 +82,6 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FMT_USE_STRONG_ENUMS FMT_HAS_FEATURE(cxx_strong_enums)
|
|
||||||
|
|
||||||
// Check if exceptions are disabled.
|
// Check if exceptions are disabled.
|
||||||
#if defined(__GNUC__) && !defined(__EXCEPTIONS)
|
#if defined(__GNUC__) && !defined(__EXCEPTIONS)
|
||||||
# define FMT_EXCEPTIONS 0
|
# define FMT_EXCEPTIONS 0
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
Tests of container utilities
|
|
||||||
|
|
||||||
Copyright (c) 2012 - 2016, Victor Zverovich
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
For the license information refer to format.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fmt/container.h"
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
using fmt::internal::ContainerBuffer;
|
|
||||||
|
|
||||||
TEST(ContainerBufferTest, Empty) {
|
|
||||||
std::string data;
|
|
||||||
ContainerBuffer<std::string> buffer(data);
|
|
||||||
EXPECT_EQ(0u, buffer.size());
|
|
||||||
EXPECT_EQ(0u, buffer.capacity());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(ContainerBufferTest, Reserve) {
|
|
||||||
std::string data;
|
|
||||||
ContainerBuffer<std::string> buffer(data);
|
|
||||||
std::size_t capacity = std::string().capacity() + 10;
|
|
||||||
buffer.reserve(capacity);
|
|
||||||
EXPECT_EQ(0u, buffer.size());
|
|
||||||
EXPECT_EQ(capacity, buffer.capacity());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(ContainerBufferTest, Resize) {
|
|
||||||
std::string data;
|
|
||||||
ContainerBuffer<std::string> buffer(data);
|
|
||||||
std::size_t size = std::string().capacity() + 10;
|
|
||||||
buffer.resize(size);
|
|
||||||
EXPECT_EQ(size, buffer.size());
|
|
||||||
EXPECT_EQ(size, buffer.capacity());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(ContainerBufferTest, Append) {
|
|
||||||
std::string data("Why so");
|
|
||||||
const std::string serious(" serious");
|
|
||||||
ContainerBuffer<std::string> buffer(data);
|
|
||||||
buffer.append(serious.c_str(), serious.c_str() + serious.length());
|
|
||||||
EXPECT_EQ("Why so serious", data);
|
|
||||||
EXPECT_EQ(data.length(), buffer.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(BasicContainerWriterTest, String) {
|
|
||||||
std::string data;
|
|
||||||
fmt::BasicContainerWriter<std::string> out(data);
|
|
||||||
out << "The answer is " << 42 << "\n";
|
|
||||||
EXPECT_EQ("The answer is 42\n", data);
|
|
||||||
EXPECT_EQ(17u, out.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(BasicContainerWriterTest, WString) {
|
|
||||||
std::wstring data;
|
|
||||||
fmt::BasicContainerWriter<std::wstring> out(data);
|
|
||||||
out << "The answer is " << 42 << "\n";
|
|
||||||
EXPECT_EQ(L"The answer is 42\n", data);
|
|
||||||
EXPECT_EQ(17u, out.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(BasicContainerWriterTest, Vector) {
|
|
||||||
std::vector<char> data;
|
|
||||||
fmt::BasicContainerWriter<std::vector<char> > out(data);
|
|
||||||
out << "The answer is " << 42 << "\n";
|
|
||||||
EXPECT_EQ(17u, data.size());
|
|
||||||
EXPECT_EQ(out.size(), data.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(BasicContainerWriterTest, StringAppend) {
|
|
||||||
std::string data("The");
|
|
||||||
fmt::BasicContainerWriter<std::string> out(data);
|
|
||||||
EXPECT_EQ(3u, data.size());
|
|
||||||
EXPECT_EQ(3u, out.size());
|
|
||||||
out << " answer is " << 42 << "\n";
|
|
||||||
EXPECT_EQ("The answer is 42\n", data);
|
|
||||||
EXPECT_EQ(17u, out.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(BasicContainerWriterTest, VectorAppend) {
|
|
||||||
std::vector<char> data;
|
|
||||||
data.push_back('T');
|
|
||||||
data.push_back('h');
|
|
||||||
data.push_back('e');
|
|
||||||
fmt::BasicContainerWriter<std::vector<char> > out(data);
|
|
||||||
EXPECT_EQ(3u, data.size());
|
|
||||||
EXPECT_EQ(3u, out.size());
|
|
||||||
out << " answer is " << 42 << "\n";
|
|
||||||
EXPECT_EQ(17u, data.size());
|
|
||||||
EXPECT_EQ(17u, out.size());
|
|
||||||
}
|
|
@ -1508,7 +1508,7 @@ TEST(FormatTest, Enum) {
|
|||||||
EXPECT_EQ("0", fmt::format("{}", A));
|
EXPECT_EQ("0", fmt::format("{}", A));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FMT_USE_STRONG_ENUMS
|
#if FMT_HAS_FEATURE(cxx_strong_enums)
|
||||||
enum TestFixedEnum : short { B };
|
enum TestFixedEnum : short { B };
|
||||||
|
|
||||||
TEST(FormatTest, FixedEnum) {
|
TEST(FormatTest, FixedEnum) {
|
||||||
|
Loading…
Reference in New Issue
Block a user