no need to append space, as strings can be quoted

This commit is contained in:
proddy
2024-07-10 13:12:18 +02:00
parent 7b80524a5a
commit 4a2036d588
2 changed files with 9 additions and 7 deletions

View File

@@ -508,12 +508,17 @@ void WebSchedulerService::test() {
test_value = "hello";
EMSESP::logger().warning("Shunting yard test 3: %s = %s", test_value.c_str(), compute(test_value).c_str());
test_value = "locale is system/settings/locale";
EMSESP::logger().warning("Shunting yard test 4: %s = %s", test_value.c_str(), compute(test_value).c_str());
// should output 'locale is en'
test_value = "\"locale is \"system/settings/locale";
command(test_cmd.c_str(), compute(test_value).c_str());
// test with negative value
test_value = "rssi is 0+system/network/rssi";
// should output 'rssi is -23'
test_value = "\"rssi is \"0+system/network/rssi";
command(test_cmd.c_str(), compute(test_value).c_str());
// should output 'rssi is -23 dbm'
test_value = "\"rssi is \"(system/network/rssi)\" dBm\"";
command(test_cmd.c_str(), compute(test_value).c_str());
}
#endif

View File

@@ -571,12 +571,9 @@ std::string calculate(const std::string & expr) {
std::string result = "";
for (const auto & s : stack) {
result += s;
if (s != stack.back()) {
result += " ";
}
}
return result;
// return stack.back();
}