Beispiel #1
0
/* ****************************************************************************
*
* versionTreat - 
*/
std::string versionTreat
(
  ConnectionInfo*            ciP,
  int                        components,
  std::vector<std::string>&  compV,
  ParseData*                 parseDataP
)
{
  std::string out     = "";
  std::string tag     = "orion";
  std::string indent  = "";

#ifdef UNIT_TEST
  std::string uptime = "0 d, 0 h, 0 m, 0 s";
#else
  std::string uptime = parsedUptime(getTimer()->getCurrentTime() - startTime);
#endif

  out += startTag1(indent, tag, true, true);
  out += valueTag1(indent + "  ", "version",       versionString,   true);
  out += valueTag1(indent + "  ", "uptime",        uptime,          true);
  out += valueTag1(indent + "  ", "git_hash",      GIT_HASH,        true);
  out += valueTag1(indent + "  ", "compile_time",  COMPILE_TIME,    true);
  out += valueTag1(indent + "  ", "compiled_by",   COMPILED_BY,     true);
  out += valueTag1(indent + "  ", "compiled_in",   COMPILED_IN,     false);
  out += endTag(indent, false, false, true, true);

  ciP->httpStatusCode = SccOk;
  return out;
}
/* ****************************************************************************
*
* parsedUptime -
*/
TEST(string, parsedUptime)
{
  std::string uptime;

  // 3 days, 4 hours, 5 min and 6 seconds
  uptime = parsedUptime(3 * (24 * 3600) + 4 * 3600 + 5 * 60 + 6);
  EXPECT_EQ(uptime, "3 d, 4 h, 5 m, 6 s");
}