コード例 #1
0
/* ****************************************************************************
*
* renderAndRelease -
*
*/
TEST(ScopeVector, renderAndRelease)
{
  Scope*         s = new Scope("Type", "Value");
  ScopeVector    sV;
  std::string    out;

  utInit();

  out = sV.toJsonV1(false);
  EXPECT_STREQ("", out.c_str());

  sV.push_back(s);

  out = sV.toJsonV1(false);

  EXPECT_EQ(sV.size(), 1);
  sV.release();
  EXPECT_EQ(sV.size(), 0);

  utExit();
}
コード例 #2
0
/* ****************************************************************************
*
* renderAndRelease - 
*
* FIXME P5 #1862: _json counterpart?
*/
TEST(ScopeVector, DISABLED_renderAndRelease)
{
  Scope*         s = new Scope("Type", "Value");
  ScopeVector    sV;
  const char*    outfile = "ngsi.scopeVector.render.middle.xml";
  std::string    out;

  utInit();

  out = sV.render("", false);
  EXPECT_STREQ("", out.c_str());

  sV.push_back(s);

  out = sV.render("", false);
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile)) << "Error getting test data from '" << outfile << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  EXPECT_EQ(sV.size(), 1);
  sV.release();
  EXPECT_EQ(sV.size(), 0);

  utExit();
}