本文整理汇总了C++中ASSERT_NOTNULL函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_NOTNULL函数的具体用法?C++ ASSERT_NOTNULL怎么用?C++ ASSERT_NOTNULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ASSERT_NOTNULL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:ziyoudefeng,项目名称:ymd,代码行数:28,代码来源:memory_test.c
示例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);
}
开发者ID:wp4398151,项目名称:TestProjectJar,代码行数:32,代码来源:Helper.cpp
示例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);
}
开发者ID:barthez,项目名称:book-recognition-with-surf,代码行数:51,代码来源:Database.cpp
示例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);
}
开发者ID:HankMa,项目名称:netcwmp,代码行数:14,代码来源:test_rpc.c
示例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);
}
开发者ID:jduimovich,项目名称:omr,代码行数:25,代码来源:CompareTest.cpp
示例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);
}
开发者ID:HankMa,项目名称:netcwmp,代码行数:32,代码来源:test_rpc.c
示例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);
}
}
开发者ID:jduimovich,项目名称:omr,代码行数:28,代码来源:TypeConversionTest.cpp
示例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);
}
开发者ID:hangshao0,项目名称:omr,代码行数:26,代码来源:TypeConversionTest.cpp
示例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);
}
开发者ID:MyWifeRules,项目名称:ufoai-1,代码行数:9,代码来源:miscmodel.cpp
示例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());
}
}
开发者ID:AresAndy,项目名称:ufoai,代码行数:9,代码来源:server.cpp
示例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";
}
}
开发者ID:Triang3l,项目名称:netradiant,代码行数:10,代码来源:server.cpp
示例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;
}
开发者ID:layerfsd,项目名称:TestProjectJar,代码行数:53,代码来源:C2DimensionParser.cpp
示例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;
}
开发者ID:wp4398151,项目名称:TestProjectJar,代码行数:21,代码来源:Helper.cpp
示例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);
}
开发者ID:HankMa,项目名称:netcwmp,代码行数:52,代码来源:test_rpc.c
示例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);
}
开发者ID:Refuge89,项目名称:TrinityCore,代码行数:13,代码来源:pet_hunter.cpp
示例16: InitGlobalPrefPath
void CGameDialog::Init()
{
InitGlobalPrefPath();
LoadPrefs();
ScanForGames();
if (mGames.empty())
{
Error("Didn't find any valid game file descriptions, aborting\n");
}
else
{
std::list<CGameDescription *>::iterator iGame, iPrevGame;
for(iGame=mGames.begin(), iPrevGame = mGames.end(); iGame!=mGames.end(); iPrevGame = iGame, ++iGame)
{
if(iPrevGame != mGames.end())
if(strcmp((*iGame)->getRequiredKeyValue("name"), (*iPrevGame)->getRequiredKeyValue("name")) < 0)
{
CGameDescription *h = *iGame;
*iGame = *iPrevGame;
*iPrevGame = h;
}
}
}
CGameDescription* currentGameDescription = 0;
if (!m_bGamePrompt)
{
// search by .game name
std::list<CGameDescription *>::iterator iGame;
for(iGame=mGames.begin(); iGame!=mGames.end(); ++iGame)
{
if ((*iGame)->mGameFile == m_sGameFile)
{
currentGameDescription = (*iGame);
break;
}
}
}
if (m_bGamePrompt || !currentGameDescription)
{
Create();
DoGameDialog();
// use m_nComboSelect to identify the game to run as and set the globals
currentGameDescription = GameDescriptionForComboItem();
ASSERT_NOTNULL(currentGameDescription);
}
g_pGameDescription = currentGameDescription;
g_pGameDescription->Dump();
}
开发者ID:clbr,项目名称:netradiant,代码行数:51,代码来源:preferences.cpp
示例17: ASSERT_NOTNULL
void Channel::GetChannelName(std::string& channelName, uint32 channelId, LocaleConstant locale, AreaTableEntry const* zoneEntry)
{
if (channelId)
{
ChatChannelsEntry const* channelEntry = sChatChannelsStore.AssertEntry(channelId);
if (!(channelEntry->Flags & CHANNEL_DBC_FLAG_GLOBAL))
{
if (channelEntry->Flags & CHANNEL_DBC_FLAG_CITY_ONLY)
channelName = Trinity::StringFormat(channelEntry->Name->Str[locale], sObjectMgr->GetTrinityString(LANG_CHANNEL_CITY, locale));
else
channelName = Trinity::StringFormat(channelEntry->Name->Str[locale], ASSERT_NOTNULL(zoneEntry)->AreaName->Str[locale]);
}
else
channelName = channelEntry->Name->Str[locale];
}
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:16,代码来源:Channel.cpp
示例18: ASSERT_NOTNULL
EntityClass *Eclass_ForName(const char *name, bool has_brushes)
{
ASSERT_NOTNULL(name);
if(string_empty(name))
{
return eclass_bad;
}
EntityClasses::iterator i = g_entityClasses.find(name);
if(i != g_entityClasses.end() && string_equal((*i).first, name))
{
return (*i).second;
}
EntityClass* e = EntityClass_Create_Default(name, has_brushes);
return Eclass_InsertAlphabetized(e);
}
开发者ID:clbr,项目名称:netradiant,代码行数:18,代码来源:eclass.cpp
示例19: MapResource_loadFile
bool MapResource_loadFile(const MapFormat& format, scene::Node& root, const char* filename)
{
globalOutputStream() << "Open file " << filename << " for read...";
TextFileInputStream file(filename);
if(!file.failed())
{
globalOutputStream() << "success\n";
ScopeDisableScreenUpdates disableScreenUpdates(path_get_filename_start(filename), "Loading Map");
ASSERT_NOTNULL(g_entityCreator);
format.readGraph(root, file, *g_entityCreator);
return true;
}
else
{
globalErrorStream() << "failure\n";
return false;
}
}
开发者ID:clbr,项目名称:netradiant,代码行数:18,代码来源:referencecache.cpp
示例20: importData
EMessageBoxReturn Dialog::DoModal()
{
importData();
PreModal();
EMessageBoxReturn ret = modal_dialog_show(m_window, m_modal);
ASSERT_NOTNULL(m_window);
if(ret == eIDOK)
{
exportData();
}
gtk_widget_hide(GTK_WIDGET(m_window));
PostModal(m_modal.ret);
return m_modal.ret;
}
开发者ID:clbr,项目名称:netradiant,代码行数:19,代码来源:dialog.cpp
注:本文中的ASSERT_NOTNULL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论