/* **************************************************************************** * * render - */ TEST(MetadataVector, render) { Metadata m("Name", "Type", "Value"); Metadata m2("Name2", "Type2", "Value2"); MetadataVector mV("registrationMetadata"); const char* outfile1 = "ngsi.metadataVector.render1.middle.json"; const char* outfile2 = "ngsi.metadataVector.render3.middle.json"; std::string out; utInit(); mV.push_back(&m); out = mV.render(""); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); mV.keyNameSet("metadata"); mV.push_back(&m2); out = mV.render(""); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); utExit(); }
Matrix IntervalMatrix::mid() const { assert(!is_empty()); Matrix mV(nb_rows(), nb_cols()); for (int i=0; i<nb_rows(); i++) { mV[i]=(*this)[i].mid(); } return mV; }
int server(void) { int s = mseminit(SEM0, 0600, 2, 0, 1); if (s == -1) { perror("mseminit"); return 1; } int cnt = 1; for (int i = 0; i < 5; ++i) { if (mP(s, 1, 0) != 0) { if (errno == EINTR) { /* interrupted by syscall, try again */ continue; } perror("mP(0)"); break; } printf("s%d", cnt); cnt += 2; fflush(stdout); if (mV(s, 1, 1) != 0) { perror("mV(1)"); break; } } /* clean up semaphores */ if (msemrm(s) != 0) { perror("msemrm"); } return 0; }