| Index: compiled/String.h |
| =================================================================== |
| --- a/compiled/String.h |
| +++ b/compiled/String.h |
| @@ -16,16 +16,20 @@ |
| */ |
| #pragma once |
| #include <algorithm> |
| #include <cstddef> |
| #include <cstring> |
| #include <type_traits> |
| +#ifdef INSIDE_TESTS |
| +#include <iostream> |
| +#include <codecvt> |
| +#endif |
| #include "debug.h" |
| #include "library.h" |
| inline void String_assert_writable(bool isWritable); |
| class String |
| { |
| @@ -188,16 +192,25 @@ |
| else if (currChar >= 128) |
| { |
| mBuf[i] = CharToLower(currChar); |
| } |
| } |
| } |
| }; |
| +#ifdef INSIDE_TESTS |
| +inline std::ostream& operator<<(std::ostream& os, const String& str) |
| +{ |
| + std::wstring_convert<std::codecvt_utf8<char16_t>, char16_t> converter; |
| + os << converter.to_bytes(str.data(), str.data() + str.length()); |
| + return os; |
| +} |
| +#endif |
| + |
| class DependentString : public String |
| { |
| public: |
| explicit DependentString() |
| : String(nullptr, 0, INVALID) |
| { |
| } |
| @@ -252,16 +265,23 @@ |
| void erase() |
| { |
| *this = DependentString(); |
| mLen = DELETED; |
| } |
| }; |
| +#ifdef INSIDE_TESTS |
| +inline std::ostream& operator<<(std::ostream& os, const DependentString& str) |
| +{ |
| + return os << static_cast<const String&>(str); |
| +} |
| +#endif |
| + |
| inline DependentString operator "" _str(const String::value_type* str, |
| String::size_type len) |
| { |
| return DependentString(str, len); |
| } |
| inline void String_assert_writable(bool isWritable) |
| { |
| @@ -415,8 +435,15 @@ |
| for (int i = size - 1; i >= 0; i--) |
| { |
| mBuf[pos + i] = '0' + (num % 10); |
| num /= 10; |
| } |
| } |
| }; |
| + |
| +#ifdef INSIDE_TESTS |
| +inline std::ostream& operator<<(std::ostream& os, const OwnedString& str) |
| +{ |
| + return os << static_cast<const String&>(str); |
| +} |
| +#endif |