本文整理汇总了C++中ASSERT_NOTNULL函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_NOTNULL函数的具体用法?C++ ASSERT_NOTNULL怎么用?C++ ASSERT_NOTNULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ASSERT_NOTNULL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_vm_alloc
int test_vm_alloc() {
int i;
int *baz, *buf = vm_zalloc(tvm, sizeof(int) * 16);
ASSERT_NOTNULL(buf);
for (i = 0; i < 16; ++i)
ASSERT_EQ(int, buf[i], 0);
vm_free(tvm, buf);
buf = vm_zalloc(tvm, sizeof(int) * 4096);
ASSERT_NOTNULL(buf);
for (i = 0; i < 4096; ++i)
ASSERT_EQ(int, buf[i], 0);
vm_free(tvm, buf);
buf = vm_zalloc(tvm, sizeof(int) * 32);
for (i = 0; i < 32; ++i)
ASSERT_EQ(int, buf[i], 0);
baz = vm_realloc(tvm, buf, sizeof(int) * 4096);
ASSERT_TRUE(buf == baz);
for (i = 0; i < 32; ++i)
ASSERT_EQ(int, baz[i], 0);
vm_free(tvm, vm_zalloc(tvm, 16));
buf = vm_realloc(tvm, baz, sizeof(int) * 1024 * 4096);
ASSERT_FALSE(buf == baz);
return 0;
}
示例2: GetCurDisplay
void GetCurDisplay(HDC& rCompatibleHDC, HBITMAP& rHbitmap)
{
HDC desktopDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
ASSERT_NOTNULL(desktopDC);
int cx = GetDeviceCaps(desktopDC, HORZRES);
int cy = GetDeviceCaps(desktopDC, VERTRES);
rCompatibleHDC = CreateCompatibleDC(desktopDC);
ASSERT_NOTNULL(rCompatibleHDC);
rHbitmap = CreateCompatibleBitmap(desktopDC, cx, cy);
ASSERT_NOTNULL(rHbitmap);
HBITMAP oldbitMap = (HBITMAP)SelectObject(rCompatibleHDC, rHbitmap);
// 因为在正常得到的图像是颠倒的,所以需要在之前处理成反的
//int res = BitBlt(rCompatibleHDC, 0, cy, cx, -1*cy, desktopDC, 0, 0, SRCCOPY);
/*
StretchBlt也允许水平或垂直翻转图像。如果cxSrc和cxDst标记(转换成设备单位以后)不同,
那么StretchBlt就建立一个镜像:左右翻转。在STRETCH程序中,通过将xDst参数改为cxClient并将cxDst参数改成-cxClient,
就可以做到这一点。如果cySrc和cyDst不同,则StretchBlt会上下翻转图像。要在STRETCH程序中测试这一点,
可将yDst参数改为cyClient并将cyDst参数改成-cyClient。
*/
int res = StretchBlt(rCompatibleHDC, 0, cy, cx, -1*cy, desktopDC, 0, 0, cx, cy,SRCCOPY);
//int res = StretchDIBits(rCompatibleHDC, 0, 0, cx, -1*cy, desktopDC, 0, 0, cx, cy,SRCCOPY);
ASSERT_NOTZERO(res);
rHbitmap = (HBITMAP)SelectObject(rCompatibleHDC, oldbitMap);
DeleteDC(desktopDC);
}
示例3: document
void BR::Database::load(std::string filename)
{
this->filename = filename;
size_t dir_pos = filename.find_last_of("\\/");
std::string filename_prefix = dir_pos == std::string::npos ? "" : filename.substr(0, dir_pos + 1);
std::string book_image_filename;
std::string book_info_filename;
TiXmlDocument document(filename.c_str());
if (!document.LoadFile())
{
throw DatabaseException("unable to load file: " + filename);
}
//get books
TiXmlElement * element = document.RootElement()->FirstChildElement("book");
do
{
Book * book = new Book();
//read XML
TiXmlElement * child = element->FirstChildElement("isbn");
ASSERT_NOTNULL(child, "Unknown file stucture. No ISBN Element.");
book->isbn = child->GetText();
child = child->NextSiblingElement("title");
ASSERT_NOTNULL(child, "Unknown file stucture. No title element.");
book->title = child->GetText();
child = child->NextSiblingElement("author");
ASSERT_NOTNULL(child, "Unknown file stucture. No author element.");
book->author = child->GetText();
child = child->NextSiblingElement("image_filename");
ASSERT_NOTNULL(child, "Unknown file stucture. No image filename.");
book_image_filename = filename_prefix + child->GetText();
child = child->NextSiblingElement("image_info_filename");
ASSERT_NOTNULL(child, "Unknown file stucture. No image info filename.");
book_info_filename = filename_prefix + child->GetText();
//load structures
cv::FileStorage fs(book_info_filename, cv::FileStorage::READ);
cv::read(fs["keypoints"], book->keypoints);
fs["descriptors"] >> book->descriptors;
fs.release();
//load image
book->image = cv::imread(book_image_filename);
books.push_back(book);
} while( (element = element->NextSiblingElement("book")) != NULL);
}
示例4: test_cwmp_get_parameter_path_node
static void test_cwmp_get_parameter_path_node (abts_case *tc, void *data)
{
cwmp_t * c = (cwmp_t*)data;
parameter_node_t * param;
FUNCTION_TRACE();
param = cwmp_get_parameter_path_node(c->root, "InternetGatewayDevice.");
ASSERT_NOTNULL(param);
param = cwmp_get_parameter_path_node(c->root, "InternetGatewayDevice.WANDevice.{i}.WANConnectionNumberOfEntries");
ASSERT_NOTNULL(param);
param = cwmp_get_parameter_path_node(c->root, "InternetGatewayDevice.WANDevice.1.WANConnectionNumberOfEntries");
ASSERT_NULL(param);
}
示例5: TEST_P
TEST_P(Int32Compare, UsingLoadParam) {
auto param = TRTest::to_struct(GetParam());
char inputTrees[120] = {0};
std::snprintf(inputTrees, 120,
"(method return=Int32 args=[Int32, Int32] "
"(block "
"(ireturn "
"(%s "
"(iload parm=0) "
"(iload parm=1)))))",
param.opcode.c_str());
auto trees = parseString(inputTrees);
ASSERT_NOTNULL(trees);
Tril::DefaultCompiler compiler{trees};
ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees;
auto entry_point = compiler.getEntryPoint<int32_t (*)(int32_t, int32_t)>();
volatile auto exp = param.oracle(param.lhs, param.rhs);
volatile auto act = entry_point(param.lhs, param.rhs);
ASSERT_EQ(exp, act);
}
示例6: test_getset_parameter_node_value
static void test_getset_parameter_node_value (abts_case *tc, void *data)
{
cwmp_t * c = (cwmp_t*)data;
parameter_node_t * param;
char * name = "InternetGatewayDevice.DeviceInfo.SoftwareVersion";
char * retval;
char * value ;
pool_t * pool = pool_create(POOL_DEFAULT_SIZE);
FUNCTION_TRACE();
param = cwmp_get_parameter_path_node(c->root, name);
ASSERT_NOTNULL(param);
value = "V1.3.x";
cwmp_set_parameter_node_value(c, param, name, value, strlen(value));
retval = cwmp_data_get_parameter_value(c, param, name, pool);
printf("retval ------------------is %s\n", retval);
ASSERT_STR_EQ(value, retval);
value = "V1.4.x";
cwmp_set_parameter_node_value(c, param, name, value, strlen(value));
retval = cwmp_data_get_parameter_value(c, param, name, pool);
ASSERT_STR_EQ(value, retval);
pool_destroy(pool);
}
示例7: TEST_P
TEST_P(DoubleToFloat, UsingConst) {
auto param = TRTest::to_struct(GetParam());
char inputTrees[512] = {0};
std::snprintf(inputTrees, 512,
"(method return=Float"
" (block"
" (freturn"
" (d2f"
" (dconst %f) ) ) ) )",
param.value);
auto trees = parseString(inputTrees);
ASSERT_NOTNULL(trees);
Tril::DefaultCompiler compiler{trees};
ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees;
auto entry_point = compiler.getEntryPoint<float (*)()>();
volatile auto exp = param.oracle(param.value);
volatile auto act = entry_point();
if (std::isnan(exp)) {
ASSERT_EQ(std::isnan(exp), std::isnan(act));
} else {
ASSERT_EQ(exp, act);
}
}
示例8: TEST_P
TEST_P(Int8ToInt32, UsingLoadParam) {
std::string arch = omrsysinfo_get_CPU_architecture();
SKIP_IF(OMRPORT_ARCH_S390 == arch || OMRPORT_ARCH_S390X == arch, KnownBug)
<< "The Z code generator incorrectly spills sub-integer types arguments (see issue #3525)";
auto param = TRTest::to_struct(GetParam());
char *inputTrees =
"(method return=Int32 args=[Int8]"
" (block"
" (ireturn"
" (b2i"
" (bload parm=0) ) ) ) )";
auto trees = parseString(inputTrees);
ASSERT_NOTNULL(trees);
Tril::DefaultCompiler compiler{trees};
ASSERT_EQ(0, compiler.compile()) << "Compilation failed unexpectedly\n" << "Input trees: " << inputTrees;
auto entry_point = compiler.getEntryPoint<int32_t (*)(int8_t)>();
volatile auto exp = param.oracle(param.value);
volatile auto act = entry_point(param.value);
ASSERT_EQ(exp, act);
}
示例9: renderSolid
void renderSolid (Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected) const
{
if (selected) {
m_renderOrigin.render(renderer, volume, localToWorld);
}
ASSERT_NOTNULL(m_entity.getEntityClass().m_state_wire);
renderer.SetState(m_entity.getEntityClass().m_state_wire, Renderer::eWireframeOnly);
}
示例10: registerModule
void registerModule (const std::string& type, int version, const std::string& name, Module& module)
{
ASSERT_NOTNULL(&module);
if (!m_modules.insert(Modules_::value_type(ModuleKey(ModuleType(type, version), name), &module)).second) {
g_warning("Module already registered: type='%s' name='%s'\n", type.c_str(), name.c_str());
} else {
g_message("Module registered: type='%s' version='%i' name='%s'\n", type.c_str(), version, name.c_str());
}
}
示例11: registerModule
void registerModule( const char* type, int version, const char* name, Module& module ){
ASSERT_NOTNULL( &module );
if ( !m_modules.insert( Modules_::value_type( ModuleKey( ModuleType( type, version ), name ), &module ) ).second ) {
globalErrorStream() << "module already registered: type=" << makeQuoted( type ) << " name=" << makeQuoted( name ) << "\n";
}
else
{
globalOutputStream() << "Module Registered: type=" << makeQuoted( type ) << " version=" << makeQuoted( version ) << " name=" << makeQuoted( name ) << "\n";
}
}
示例12: ItoWStatic
bool C2DimensionSourceIndexFile::GenerateType(wstring* wstrColoumnName)
{
m_wstrResultContent += L"public:\r\n";
m_wstrResultContent += L"static const void* s_pColounm[";
m_wstrResultContent += ItoWStatic(m_ColumnCount);
m_wstrResultContent += L"];\r\n";
unsigned int curPos = m_wstrMetaRow.find(L"\t", 0) + 1;
int colIndex = 0;
while (curPos < m_wstrMetaRow.size())
{
wstring wFieldStr = m_wstrMetaRow.substr(curPos, m_wstrMetaRow.find(L"\t", curPos) - curPos);
int typePos = wFieldStr.find(L":", 0);
ASSERT_NEQU(typePos, string::npos);
wstring wstrFieldName = wFieldStr.substr(0, typePos);
wstring wstrType = wFieldStr.substr(typePos + 1, wFieldStr.size() - (typePos + 1));
TypeContainer *pTypeContainer = GetTypeContaner((WCHAR*)wstrType.c_str());
ASSERT_NOTNULL(pTypeContainer);
m_wstrResultContent += L"\t";
wstrColoumnName[colIndex] = wstrFieldName;
m_ConvertFunc[colIndex++] = pTypeContainer->pValueFunc;
m_wstrResultContent += L"static const ";
m_wstrResultContent += pTypeContainer->pMemberStr;
m_wstrResultContent += L" m_";
m_wstrResultContent += wstrFieldName;
m_wstrResultContent += L"[";
m_wstrResultContent += ItoWStatic(m_RowCount);
m_wstrResultContent += L"];\r\n";
curPos = m_wstrMetaRow.find(L"\t", curPos) + 1;
}
m_wstrResultContent += L"\t const static int m_Size;\r\n";
m_wstrResultContent += L"\t template<typename T>\r\n";
m_wstrResultContent += L"\t static bool GetCell(int x, int y, T& res){\r\n";
m_wstrResultContent += L"if (ISINRANGE(x, 0, ";
m_wstrResultContent += ItoWStatic(m_RowCount-1);
m_wstrResultContent += L") && ISINRANGE(y, 0, ";
m_wstrResultContent += ItoWStatic(m_ColumnCount - 1);
m_wstrResultContent += L")){\r\n";
m_wstrResultContent += L"res = ((T*)s_pColounm[y])[x];\r\n";
m_wstrResultContent += L"return true;";
m_wstrResultContent += L"}else{\r\n";
m_wstrResultContent += L"return false; }\r\n";
m_wstrResultContent += L"}\r\n";
m_wstrResultContent += L"};\r\n";
return true;
}
示例13: GetCaptureScreenDCRGBbits
char* GetCaptureScreenDCRGBbits(int& rWidth,int& rHeight, int& rPixelBitSize)
{
HDC compatibleHDC = NULL;
HBITMAP compatibleHbitmap = NULL;
compatibleHDC = NULL;
compatibleHbitmap = NULL;
GetCurDisplay(compatibleHDC, compatibleHbitmap);
ASSERT_NOTNULL(compatibleHDC);
ASSERT_NOTNULL(compatibleHbitmap);
BITMAPINFO rBmpinfo = { 0 };
GetBitmapInfo(rBmpinfo, compatibleHbitmap);
rWidth = rBmpinfo.bmiHeader.biWidth;
rHeight = rBmpinfo.bmiHeader.biHeight;
rPixelBitSize = rBmpinfo.bmiHeader.biBitCount;
char* lpRGBBits = GetBMPBinaryData(&rBmpinfo, compatibleHbitmap, compatibleHDC);
ASSERT_NOTNULL(lpRGBBits);
DeleteDC(compatibleHDC);
DeleteObject(compatibleHbitmap);
return lpRGBBits;
}
示例14: test_cwmp_session_create_addobject
static void test_cwmp_session_create_addobject(abts_case *tc, void *data)
{
cwmp_t * cwmp = (cwmp_t*)data;
pool_t * pool = pool_create(POOL_DEFAULT_SIZE);
xmldoc_t * doc, *newdoc;
char * message = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:cwmp=\"urn:dslforum-org:cwmp-1-0\" xmlns=\"urn:dslforum-org:cwmp-1-0\"><SOAP-ENV:Header><cwmp:ID soap:mustUnderstand=\"1\">1234</cwmp:ID></SOAP-ENV:Header> \
<SOAP-ENV:Body><cwmp:AddObject><ObjectName>InternetGatewayDevice.WANDevice.</ObjectName><ParameterKey></ParameterKey></cwmp:AddObject></SOAP-ENV:Body></SOAP-ENV:Envelope>"
;
printf("create session\n");
cwmp_session_t * session = cwmp_session_create(cwmp);
pool_create(POOL_DEFAULT_SIZE);
pool_create(POOL_DEFAULT_SIZE);
pool_create(POOL_DEFAULT_SIZE);
pool_create(POOL_DEFAULT_SIZE);
pool_create(POOL_DEFAULT_SIZE);
pool_create(POOL_DEFAULT_SIZE);
pool_create(POOL_DEFAULT_SIZE);
pool_create(POOL_DEFAULT_SIZE);
printf("open session \n");
cwmp_session_open(session);
cwmp_uint32_t msglength = strlen(message);
size_t len;
char *xmlbuf = pool_palloc(pool, msglength+32);
len = sprintf(xmlbuf,"<cwmp>");
strncpy(xmlbuf + len, message, msglength);
strcpy(xmlbuf + len + msglength, "</cwmp>");
// strcat(xmlbuf, "</cwmp>");
// xmlbuf[len+msglength+7] = '\0';
printf("agent analyse xml: \n%s", xmlbuf);
doc = XmlParseBuffer(pool, xmlbuf);
ASSERT_NOTNULL(doc);
newdoc = cwmp_session_create_addobject_response_message(session, doc, pool);
cwmp_write_doc_to_chunk(newdoc, session->writers, pool);
cwmp_chunk_print(session->writers);
pool_destroy(pool);
}
示例15: HandleProc
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
caster->CastSpell(nullptr, SPELL_PET_GUARD_DOG_HAPPINESS, aurEff);
Unit* target = eventInfo.GetProcTarget();
if (!target->CanHaveThreatList())
return;
float addThreat = CalculatePct(ASSERT_NOTNULL(eventInfo.GetSpellInfo())->Effects[EFFECT_0].CalcValue(caster), aurEff->GetAmount());
target->GetThreatManager().AddThreat(caster, addThreat, GetSpellInfo(), false, true);
}