Skip to content

Commit

Permalink
added tests for copying and insertion (closes #49)
Browse files Browse the repository at this point in the history
also:
- added tests to catch any regressions of pull/50
- moved UTF-8 decoder copyright notice
- cleaned up static assert messages
  • Loading branch information
marzer committed Aug 2, 2020
1 parent 6f7f6c6 commit b024ee6
Show file tree
Hide file tree
Showing 14 changed files with 586 additions and 221 deletions.
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
MIT License

Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de> (utf8_decoder)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
Expand Down
1 change: 0 additions & 1 deletion include/toml++/toml.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
#undef TOML_PUSH_WARNINGS
#undef TOML_RELOPS_REORDERING
#undef TOML_SA_LIST_BEG
#undef TOML_SA_LIST_CAP
#undef TOML_SA_LIST_END
#undef TOML_SA_LIST_NEW
#undef TOML_SA_LIST_NXT
Expand Down
2 changes: 1 addition & 1 deletion include/toml++/toml_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TOML_POP_WARNINGS
#define TOML_ENV_MESSAGE \
"If you're seeing this error it's because you're building toml++ for an environment that doesn't conform to " \
"one of the 'ground truths' assumed by the library. Essentially this just means that I don't have the " \
"resources to test on more esoteric platforms, but I wish I did! You can try disabling the checks by defining " \
"resources to test on more platforms, but I wish I did! You can try disabling the checks by defining " \
"TOML_DISABLE_ENVIRONMENT_CHECKS, but your mileage may vary. Please consider filing an issue at " \
"https://github.com/marzer/tomlplusplus/issues to help me improve support for your target environment. Thanks!"

Expand Down
2 changes: 0 additions & 2 deletions include/toml++/toml_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ TOML_DISABLE_MISC_WARNINGS
#define TOML_SA_LIST_END ")"
#define TOML_SA_LIST_NEW " "
#define TOML_SA_LIST_NXT ", "
#define TOML_SA_LIST_CAP(...)

#else

Expand All @@ -28,7 +27,6 @@ TOML_DISABLE_MISC_WARNINGS
#define TOML_SA_LIST_END
#define TOML_SA_LIST_NEW TOML_SA_NEWLINE TOML_SA_NEWLINE
#define TOML_SA_LIST_NXT TOML_SA_LIST_NEW
#define TOML_SA_LIST_CAP(val) val

#endif

Expand Down
2 changes: 2 additions & 0 deletions include/toml++/toml_utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,8 @@ TOML_IMPL_NAMESPACE_START
return codepoint >= 0xD800u && codepoint <= 0xDFFF;
}

// utf8_decoder based on this: https://bjoern.hoehrmann.de/utf-8/decoder/dfa/
// Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
struct utf8_decoder final
{
uint_least32_t state{};
Expand Down
37 changes: 18 additions & 19 deletions include/toml++/toml_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,16 @@ TOML_NAMESPACE_START
TOML_SA_LIST_SEP "std::wstring"
#endif
TOML_SA_LIST_SEP "any signed integer type >= 64 bits"
TOML_SA_LIST_SEP "any floating-point type >= 64 bits of precision"
TOML_SA_LIST_SEP "any floating-point type >= 64 bits"
TOML_SA_LIST_END

TOML_SA_LIST_NXT "An immutable view type not requiring additional temporary storage"
TOML_SA_LIST_BEG "std::string_view"
TOML_SA_LIST_SEP "const char*"
#ifdef __cpp_lib_char8_t
TOML_SA_LIST_SEP "std::u8string_view"
#endif
TOML_SA_LIST_SEP "const char*"
#ifdef __cpp_lib_char8_t
TOML_SA_LIST_SEP "const char8_t*"
#endif
TOML_SA_LIST_END
Expand Down Expand Up @@ -598,19 +600,21 @@ TOML_NAMESPACE_START
TOML_SA_LIST_SEP "std::wstring"
#endif
TOML_SA_LIST_SEP "any signed integer type >= 64 bits"
TOML_SA_LIST_SEP "any floating-point type >= 64 bits of precision"
TOML_SA_LIST_SEP "any floating-point type >= 64 bits"
TOML_SA_LIST_END

TOML_SA_LIST_NXT "A non-view type capable of (reasonably) representing a native TOML value type"
TOML_SA_LIST_BEG "any other integer type"
TOML_SA_LIST_SEP "any floating-point type >= 32 bits of precision"
TOML_SA_LIST_SEP "any floating-point type >= 32 bits"
TOML_SA_LIST_END

TOML_SA_LIST_NXT "An immutable view type not requiring additional temporary storage"
TOML_SA_LIST_BEG "std::string_view"
TOML_SA_LIST_SEP "const char*"
#ifdef __cpp_lib_char8_t
TOML_SA_LIST_SEP "std::u8string_view"
#endif
TOML_SA_LIST_SEP "const char*"
#ifdef __cpp_lib_char8_t
TOML_SA_LIST_SEP "const char8_t*"
#endif
TOML_SA_LIST_END
Expand Down Expand Up @@ -766,33 +770,28 @@ TOML_NAMESPACE_START
TOML_SA_LIST_SEP "std::wstring"
#endif
TOML_SA_LIST_SEP "any signed integer type >= 64 bits"
TOML_SA_LIST_SEP "any floating-point type >= 64 bits of precision"
TOML_SA_LIST_SEP "any floating-point type >= 64 bits"
TOML_SA_LIST_END

TOML_SA_LIST_NXT "A non-view type capable of (reasonably) representing a native TOML value type"
TOML_SA_LIST_BEG "any other integer type"
TOML_SA_LIST_SEP "any floating-point type >= 32 bits of precision"
TOML_SA_LIST_SEP "any floating-point type >= 32 bits"
TOML_SA_LIST_END

TOML_SA_LIST_NXT "A compatible view type"
TOML_SA_LIST_BEG "std::string_view"
TOML_SA_LIST_SEP "const char*"
TOML_SA_LIST_SEP "const char[]" TOML_SA_LIST_CAP(" (returned as const char*)")
TOML_SA_LIST_SEP "char*" TOML_SA_LIST_CAP(" (returned as const char*)")
TOML_SA_LIST_SEP "char[]" TOML_SA_LIST_CAP(" (returned as const char*)")
#ifdef __cpp_lib_char8_t
TOML_SA_LIST_SEP "std::u8string_view"
#endif
#if TOML_WINDOWS_COMPAT
TOML_SA_LIST_SEP "std::wstring_view"
#endif
TOML_SA_LIST_SEP "const char*"
#ifdef __cpp_lib_char8_t
TOML_SA_LIST_SEP "const char8_t*"
TOML_SA_LIST_SEP "const char8_t[]" TOML_SA_LIST_CAP(" (returned as const char8_t*)")
TOML_SA_LIST_SEP "char8_t*" TOML_SA_LIST_CAP(" (returned as const char8_t*)")
TOML_SA_LIST_SEP "char8_t[]" TOML_SA_LIST_CAP(" (returned as const char8_t*)")
#endif
#if TOML_WINDOWS_COMPAT
TOML_SA_LIST_SEP "std::wstring_view" TOML_SA_LIST_CAP(" (returned as std::wstring)")
TOML_SA_LIST_SEP "const wchar_t*" TOML_SA_LIST_CAP(" (returned as std::wstring)")
TOML_SA_LIST_SEP "const wchar_t[]" TOML_SA_LIST_CAP(" (returned as std::wstring)")
TOML_SA_LIST_SEP "wchar_t*" TOML_SA_LIST_CAP(" (returned as std::wstring)")
TOML_SA_LIST_SEP "wchar_t[]" TOML_SA_LIST_CAP(" (returned as std::wstring)")
TOML_SA_LIST_SEP "const wchar_t*"
#endif
TOML_SA_LIST_END
);
Expand Down
Loading

0 comments on commit b024ee6

Please sign in to comment.