From 8f3c4a375dc9bd7ce2647b146da762397e177df1 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Sun, 22 Dec 2024 08:24:17 +0100 Subject: [PATCH] options: Fix a small issue with vector formatting --- library/private/options_tools.h.in | 2 +- library/testing/TestSDKOptions.cxx | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/library/private/options_tools.h.in b/library/private/options_tools.h.in index 221dc674b9..c4ad8ff38c 100644 --- a/library/private/options_tools.h.in +++ b/library/private/options_tools.h.in @@ -264,7 +264,7 @@ std::string format(const std::vector& var) unsigned int i = 0; for (auto& elem : var) { - stream << ((i > 0) ? ", " : "") << options_tools::format(elem); + stream << ((i > 0) ? "," : "") << options_tools::format(elem); i++; } return stream.str(); diff --git a/library/testing/TestSDKOptions.cxx b/library/testing/TestSDKOptions.cxx index 0124bd1168..3d88c7f4b9 100644 --- a/library/testing/TestSDKOptions.cxx +++ b/library/testing/TestSDKOptions.cxx @@ -73,11 +73,14 @@ int TestSDKOptions(int argc, char* argv[]) test("set/get string", std::get(opt.get("model.color.texture")) == "test"); // Test double vector - opt.setAsString("render.background.color", "0.1, 0.2, 0.4"); - test("setAsString vector", opt.getAsString("render.background.color") == "0.1, 0.2, 0.4"); + opt.setAsString("render.background.color", "0.1,0.2,0.4"); + test("setAsString vector", opt.getAsString("render.background.color") == "0.1,0.2,0.4"); + + opt.setAsString("render.background.color", "0.1, 0.3, 0.4"); + test("setAsString spaces vector", opt.getAsString("render.background.color") == "0.1,0.3,0.4"); opt.render.background.color = { 0.1, 0.2, 0.5 }; - test("getAsString vector", opt.getAsString("render.background.color") == "0.1, 0.2, 0.5"); + test("getAsString vector", opt.getAsString("render.background.color") == "0.1,0.2,0.5"); opt.set("render.background.color", std::vector{ 0.1, 0.2, 0.3 }); test("set/get vector",