#include <cstring>
#include <stdio.h>
#include <cstdlib>
+#include <sstream>
+
using std::string;
uint16_t get_checksum(const string &to_check)
return cwd + '/' + path;
}
+// FIXME this does not handle empty strings correctly
//split a string on a delimiter, return a vector of the split tokens
vector<string> split(const char *str, char c)
{
return result;
}
+// FIXME this does not handle empty strings correctly
// parse a number list "1.1,2.2,3.3" and return the numbers in a vector of floats
vector<float> parse_number_list(const char *str)
{
}
return r;
}
+
+std::string append_parameters(std::map<char,float> params)
+{
+ std::ostringstream oss;
+ for(auto &i : params) {
+ oss << i.first << i.second << " ";
+ }
+ return oss.str();
+}
ASSERT_TRUE(v[1] == 2.2F);
ASSERT_TRUE(v[2] == 3.3F);
}
+
+TEST(UtilsTest,append_parameters)
+{
+ std::string str;
+
+ str= append_parameters({{'X', 1}, {'Y', 2}, {'Z', 3}});
+ ASSERT_EQUALS(str, "X1 Y2 Z3 ");
+}