12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #include "stdafx.h"
- #include "mod_SampleEntity.h"
- #include "SpTest.h"
- // This code is generated by spgenex tool!
- RVC_TEST_CASE_METHOD(CSampleEntity, "TestForCSampleEntity")
- {
- Dbg("TestForCSampleEntity Debug.");
- return Error_Succeed;
- }
- RVC_TEST_CASE_METHOD(CSampleEntity, "TestForCSampleEntity2")
- {
- Dbg("TestForCSampleEntity2 Debug.");
- return Error_Succeed;
- }
- RVC_TEST_CASE("TestForCSampleEntity3")
- {
- CSampleEntity entity;
- Dbg("TestForCSampleEntity3 Debug: %s %s", entity.GetEntityName(), entity.GetEntityVersion());
- return Error_Unexpect;
- }
- RVC_TEST_CASE_VOID_CONTEXT(CSampleEntity, "SimpleContextTest") {
- SpReqAnsContext<SampleService_TwoWayFuncNotOverlap_Req, SampleService_TwoWayFuncNotOverlap_Ans>::Pointer ctx =
- new SpReqAnsContext<SampleService_TwoWayFuncNotOverlap_Req, SampleService_TwoWayFuncNotOverlap_Ans>(pTransactionContext);
- /** Set ctx->Req*/
- /*The aim function you would like test.*/
- if (Error_Succeed == TwoWayFuncNotOverlap(ctx)) {
- /** Check ctx->Ans' validty.*/
- /** Overwite the Result using pTransactionContext->SendAnswer()*/
- }
- }
- /** The aim test function must be member method of {entityClassName} and its signature should be like that
- ErrorCodeEnum --////teturn type must be ErrorCodeEnum
- {contextName} -- ////the function name is the same as the struct name generated by spgen tool.
- (SpReqAnsContext<{serviceName}_{contextName}_Req, serviceName}_{contextName}_Ans>::Pointer ctx)
- */
- RVC_TEST_CASE_CONTEXT_TWO_WAY(CSampleEntity, SampleService, TwoWayFuncOverlap, "TwoWayFuncOverlapName")
- {
- Req.req_context = "hello";
- TWO_WAY_CHECK_ANSWER_BEGIN(Ans)
- if (Ans.ans_context.Compare("world", true) != 0) {
- LOG_TRACE("Check failed, return except Error_Succeed");
- return Error_Unexpect;
- }
- Dbg("TwoWayFuncOverlap two way enter");
- return Error_Succeed;
- TWO_WAY_CHECK_ANSWER_END()
- }
- RVC_REGISTER_TEST_CASE_CONTEXT(CSampleEntity, SampleService, TwoWayFuncNormal, "TwoWayFuncNormal", "XXXXX")
- {
- Req.tbool = true;
- Req.tchar = 'I';
- Req.tint = 123;
- Req.tuint = 123;
- Req.tshort = 123;
- Req.tushort = 123;
- Req.tuchar = 'I';
- Req.tstring = "SampleService_TwoWayFuncNormal_Req::tstring::xclvmsdiofjweoij3r283908u238925j4ioijn;klgnfakjsfsfhffjeoiwjhoi";
- Req.twstring = "SampleService_TwoWayFuncNormal_Req::twstring::xclvmsdiofjweoij3r283908u238925j4ioijn;klgnfakjsfsfhffjeoiwjhoi";
- Req.tfloat = 123.456f;
- Req.tdouble = 123.456;
- Req.tblob.Clear();
- Req.tint64 = 123;
- Req.tuint64 = 123;
- ANSWER_CHECK(Ans.sarray_string.GetCount() == 2); /*this would pass*/
- ANSWER_REQUIRE(Ans.sarray_string[0] == "String1"); /*this would pass*/
- ANSWER_REQUIRE(Ans.sarray_string[1] == "String3"); /*this would be failed, abort*/
- ANSWER_CHECK(Ans.sarray_string[2] == "String3"); /*this would not invoke*/
- }
- SP_BEGIN_ENTITY_MAP()
- SP_ENTITY(CSampleEntity)
- SP_END_ENTITY_MAP()
|