/* **************************************************************************** * * render - */ TEST(StatusCode, render) { StatusCode sc1; StatusCode sc2(SccOk, ""); StatusCode sc3(SccOk, "DETAILS"); StatusCode sc4(SccOk, "DETAILS"); std::string out; const char* outfile1 = "ngsi.statusCode.render1.valid.xml"; const char* outfile2 = "ngsi.statusCode.render2.valid.xml"; const char* outfile3 = "ngsi.statusCode.render3.valid.xml"; const char* outfile4 = "ngsi.statusCode.render4.middle.json"; utInit(); out = sc1.render(XML, ""); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); out = sc2.render(XML, ""); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); out = sc3.render(XML, ""); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile3)) << "Error getting test data from '" << outfile3 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); out = sc4.render(JSON, ""); EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile4)) << "Error getting test data from '" << outfile4 << "'"; EXPECT_STREQ(expectedBuf, out.c_str()); sc1.release(); // just to exercise the code ... utExit(); }
v->f1=f1?f1:jtdomainerr1; /* monad C function */ v->f2=f2?f2:jtdomainerr2; /* dyad C function */ v->mr=m; /* monadic rank */ v->lr=l; /* left rank */ v->rr=r; /* right rank */ v->fdep=1; /* function depth */ v->id=id; /* spelling */ pst[(UC)id]=z; /* other fields are zeroed in ga() */ R 1; } B jtpinit(J jt){A t;C*s; MC(wtype,ctype,256L); wtype['N']=CN; wtype['B']=CB; GA(alp,LIT,NALP,1,0); s=CAV(alp); DO(NALP,*s++=(C)i;); /* a. */ pst[(UC)CALP ]=t=alp; ACX(t); /* a: */ pst[(UC)CACE ]=t=ace=sc4(BOX,(I)mtv); ACX(t); /* ( */ pst[(UC)CLPAR]=t=sc4(LPAR,0L); ACX(t); /* ) */ pst[(UC)CRPAR]=t=sc4(RPAR,0L); ACX(t); /* =. */ GA(t,ASGN,1,0,0); ACX(t); *CAV(t)=CASGN; pst[(UC)CASGN ]=t; /* =: */ GA(t,ASGN,1,0,0); ACX(t); *CAV(t)=CGASGN; pst[(UC)CGASGN]=t; /* = */ pdef(CEQ, VERB, jtsclass, jteq, RMAX,0, 0 ); /* =. */ /* see above */ /* =: */ /* see above */ /* < */ pdef(CBOX, VERB, jtbox, jtlt, RMAX,0, 0 ); /* <. */ pdef(CFLOOR, VERB, jtfloor1, jtminimum,0, 0, 0 ); /* <: */ pdef(CLE, VERB, jtdecrem, jtle, 0, 0, 0 ); /* > */ pdef(COPE, VERB, jtope, jtgt, 0, 0, 0 ); /* >. */ pdef(CCEIL, VERB, jtceil1, jtmaximum,0, 0, 0 ); /* >: */ pdef(CGE, VERB, jtincrem, jtge, 0, 0, 0 ); /* + */ pdef(CPLUS, VERB, jtconjug, jtplus, 0, 0, 0 );