More valgrind fixes
continuous-integration/drone/push Build is failing Details

Signed-off-by: Deukhoofd <deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2019-06-24 15:09:00 +02:00
parent 021750a135
commit 907e444389
1 changed files with 2 additions and 3 deletions

View File

@ -33,7 +33,6 @@ namespace Porygon::Evaluation {
for (int i = 0; i < result.size(); i++){
dst[i] = result[i];
}
dst[result.size() + 1] = '\0';
return 0;
}
@ -60,7 +59,6 @@ namespace Porygon::Evaluation {
#include <catch.hpp>
#include "../src/Script.hpp"
TEST_CASE( "Evaluate String", "[integration]" ) {
auto sc = new u16string(u"\"foo bar\"");
auto script = Porygon::Script::Create(*sc);
@ -68,10 +66,11 @@ TEST_CASE( "Evaluate String", "[integration]" ) {
script->Evaluate();
auto lastValue = script->GetLastValue();
size_t size = GetEvalValueStringLength(lastValue);
char16_t dst[size + 1];
auto dst = new char16_t[size + 1]{'\0'};
EvaluateEvalValueString(lastValue, dst);
auto s = u16string(dst);
REQUIRE(s == u"foo bar");
delete[] dst;
delete script;
delete sc;
}