mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 04:54:19 -04:00
Add a common function to generate a long string to test.
This commit is contained in:
@ -103,6 +103,27 @@ inline bool fileEqual(const string &filename1, const string &filename2)
|
||||
return stream1.good() == stream2.good();
|
||||
}
|
||||
|
||||
#ifdef TAGLIB_STRING_H
|
||||
|
||||
namespace TagLib {
|
||||
|
||||
inline String longText(size_t length, bool random = false)
|
||||
{
|
||||
const wchar_t chars[] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_";
|
||||
|
||||
std::wstring text(length, L'X');
|
||||
|
||||
if(random) {
|
||||
for(size_t i = 0; i < length; ++i)
|
||||
text[i] = chars[rand() % 53];
|
||||
}
|
||||
|
||||
return String(text);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
class ScopedFileCopy
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user