diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2020-03-27 09:44:43 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2020-03-27 09:44:43 +0000 |
commit | 95ec5f00b5b7105def9d67bfbd00ec758e5585dc (patch) | |
tree | 25d717e1a110809600ac26ae0e6a962b16b6d0ac /vsm | |
parent | 938a5b85fb627102badae042ade56feebc11fcdf (diff) |
Make room for terminating UCS4 character in unit test
Also replace dynamic stack buffer with a heap buffer.
Diffstat (limited to 'vsm')
-rw-r--r-- | vsm/src/tests/textutil/textutil.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/vsm/src/tests/textutil/textutil.cpp b/vsm/src/tests/textutil/textutil.cpp index e71b95f22f9..581419fc80e 100644 --- a/vsm/src/tests/textutil/textutil.cpp +++ b/vsm/src/tests/textutil/textutil.cpp @@ -60,10 +60,10 @@ void TextUtilTest::assertSkipSeparators(const char * input, size_t len, const UCS4V & expdstbuf, const SizeV & expoffsets) { const byte * srcbuf = reinterpret_cast<const byte *>(input); - ucs4_t dstbuf[len]; - size_t offsets[len]; + auto dstbuf = std::make_unique<ucs4_t[]>(len + 1); + auto offsets = std::make_unique<size_t[]>(len + 1); UTF8StrChrFieldSearcher fs; - BW bw(dstbuf, offsets); + BW bw(dstbuf.get(), offsets.get()); size_t dstlen = fs.skipSeparators(srcbuf, len, bw); EXPECT_EQUAL(dstlen, expdstbuf.size()); ASSERT_TRUE(dstlen == expdstbuf.size()); |