这篇教程C++ ASSERT_MSG函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ASSERT_MSG函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_MSG函数的具体用法?C++ ASSERT_MSG怎么用?C++ ASSERT_MSG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ASSERT_MSG函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: LoadOffsets/* stores the table of offsets for all records of the current file for faster access. */static void LoadOffsets(axxPacFD fd){ MemPtr mp; /* assumption: there is just one file being read */ ASSERT_MSG("AIM6", currFileDesc == -1); axxPacSeek(LibRef, fd, 76, SEEK_SET); axxPacRead(LibRef, fd, &nrec, 2); moff = MemHandleNew(nrec * 8L); ASSERT_MSG("AIM3", moff != 0); mp = MemHandleLock(moff); ASSERT_MSG("AIM4", mp != 0); axxPacSeek(LibRef, fd, 78, SEEK_SET); axxPacRead(LibRef, fd, mp, nrec * 8L); MemHandleUnlock(moff); currFileDesc = fd; nrec--;}
开发者ID:TimofonicJunkRoom,项目名称:plucker,代码行数:23,
示例2: ASSERT_MSGvoid VertexLoader::Setup(const PipelineRegs& regs) { ASSERT_MSG(!is_setup, "VertexLoader is not intended to be setup more than once."); const auto& attribute_config = regs.vertex_attributes; num_total_attributes = attribute_config.GetNumTotalAttributes(); boost::fill(vertex_attribute_sources, 0xdeadbeef); for (int i = 0; i < 16; i++) { vertex_attribute_is_default[i] = attribute_config.IsDefaultAttribute(i); } // Setup attribute data from loaders for (int loader = 0; loader < 12; ++loader) { const auto& loader_config = attribute_config.attribute_loaders[loader]; u32 offset = 0; // TODO: What happens if a loader overwrites a previous one's data? for (unsigned component = 0; component < loader_config.component_count; ++component) { if (component >= 12) { LOG_ERROR(HW_GPU, "Overflow in the vertex attribute loader %u trying to load component %u", loader, component); continue; } u32 attribute_index = loader_config.GetComponent(component); if (attribute_index < 12) { offset = Common::AlignUp(offset, attribute_config.GetElementSizeInBytes(attribute_index)); vertex_attribute_sources[attribute_index] = loader_config.data_offset + offset; vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count); vertex_attribute_formats[attribute_index] = attribute_config.GetFormat(attribute_index); vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index); offset += attribute_config.GetStride(attribute_index); } else if (attribute_index < 16) { // Attribute ids 12, 13, 14 and 15 signify 4, 8, 12 and 16-byte paddings, // respectively offset = Common::AlignUp(offset, 4); offset += (attribute_index - 11) * 4; } else { UNREACHABLE(); // This is truly unreachable due to the number of bits for each // component } } } is_setup = true;}
开发者ID:FenrisulfrX,项目名称:citra,代码行数:53,
示例3: ASSERT_MSGvoid DX9VertexShader::setVec4( const char* paramName, const D3DXVECTOR4& vec ){ if ( m_activeConstantsTable ) { D3DXHANDLE hConstant = m_activeConstantsTable->GetConstantByName( NULL, paramName ); if ( hConstant ) { HRESULT res = m_activeConstantsTable->SetVector( m_d3Device, hConstant, &vec ); ASSERT_MSG( SUCCEEDED( res ), translateDxError( "setVec4", res ).c_str() ); } }}
开发者ID:chenwenbin928,项目名称:tamy,代码行数:12,
示例4: ASSERTconst Quadtree<T,D>* Quadtree<T,D>::FindLeafNode(const vec<T,D>* p) const{ if(IsLeaf()) { ASSERT(ContainsPoint(p)); return this; } Orthant<D> orthant = GetOrthant(p); ASSERT_MSG(children[orthant] != NULL, "The point does not appear in a leaf node in the quadtree./n"); return children[orthant]->FindLeafNode(p); }
开发者ID:MelkorOJ,项目名称:wssd_cech,代码行数:12,
示例5: mtx_initvoid mtx_init( Tmtx_ptr A, int nrows, int ncols ){ if( A->init ) mtx_free( A ); A->init = 1; A->nrows = nrows; A->ncols = ncols; A->dat = (double *)calloc( nrows*ncols, sizeof(double) ); A->tau = NULL; // This is only allocated by least squares routines ASSERT_MSG( A->dat!=NULL, "mtx_init() : unable calloc memory for dense matrix" );}
开发者ID:jackd,项目名称:FVMPor,代码行数:12,
示例6: ASSERT_MSGOrthant<D> Quadtree<T,D>::GetOrthant(const vec<T,D>* p) const{ ASSERT_MSG(ContainsPoint(p), "The node does not contain the point for which we try to find the orthant./n"); Orthant<D> orthant; for(int d=0; d<D; ++d) { orthant.Set(d, minPoint[d] + (sideLength/T(2)) < (*p)[d]); } return orthant;}
开发者ID:MelkorOJ,项目名称:wssd_cech,代码行数:12,
示例7: WriteProcessPipe/** * DSP_DSP::WriteProcessPipe service function * Inputs: * 1 : Pipe Number * 2 : Size * 3 : (size << 14) | 0x402 * 4 : Buffer * Outputs: * 0 : Return header * 1 : Result of function, 0 on success, otherwise error code */static void WriteProcessPipe(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 pipe_index = cmd_buff[1]; u32 size = cmd_buff[2]; u32 buffer = cmd_buff[4]; AudioCore::DspPipe pipe = static_cast<AudioCore::DspPipe>(pipe_index); if (IPC::StaticBufferDesc(size, 1) != cmd_buff[3]) { LOG_ERROR(Service_DSP, "IPC static buffer descriptor failed validation (0x%X). pipe=%u, " "size=0x%X, buffer=0x%08X", cmd_buff[3], pipe_index, size, buffer); cmd_buff[0] = IPC::MakeHeader(0, 1, 0); cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw; return; } ASSERT_MSG(Memory::IsValidVirtualAddress(buffer), "Invalid Buffer: pipe={}, size={:#X}, buffer={:#010X}", pipe_index, size, buffer); std::vector<u8> message(size); for (u32 i = 0; i < size; i++) { message[i] = Memory::Read8(buffer + i); } // This behaviour was confirmed by RE. // The likely reason for this is that games tend to pass in garbage at these bytes // because they read random bytes off the stack. switch (pipe) { case AudioCore::DspPipe::Audio: ASSERT(message.size() >= 4); message[2] = 0; message[3] = 0; break; case AudioCore::DspPipe::Binary: ASSERT(message.size() >= 8); message[4] = 1; message[5] = 0; message[6] = 0; message[7] = 0; break; } Core::DSP().PipeWrite(pipe, message); cmd_buff[0] = IPC::MakeHeader(0xD, 1, 0); cmd_buff[1] = RESULT_SUCCESS.raw; // No error LOG_DEBUG(Service_DSP, "pipe=%u, size=0x%X, buffer=0x%08X", pipe_index, size, buffer);}
开发者ID:DaMan69,项目名称:citra,代码行数:63,
示例8: RegisterEventEventType* RegisterEvent(const std::string& name, TimedCallback callback) { // check for existing type with same name. // we want event type names to remain unique so that we can use them for serialization. ASSERT_MSG(event_types.find(name) == event_types.end(), "CoreTiming Event /"{}/" is already registered. Events should only be registered " "during Init to avoid breaking save states.", name); auto info = event_types.emplace(name, EventType{callback, nullptr}); EventType* event_type = &info.first->second; event_type->name = &info.first->first; return event_type;}
开发者ID:DaMan69,项目名称:citra,代码行数:13,
示例9: command_postforkstatic void command_postfork(void *data) { struct lua_command_data *lcd = data; struct lua_State *L = lcd->L; ASSERT(L); // This would be called from within the lua_run_command, no need to allocate more stack if (lcd->postfork_callback) { int handler = push_err_handler(L); extract_registry_value(L, lcd->postfork_callback); int result = lua_pcall(L, 0, 0, handler); ASSERT_MSG(!result, "%s", interpreter_error_result(L)); } // We don't worry about freeing memory here. We're going to exec just in a while.}
开发者ID:CZ-NIC,项目名称:turris-updater,代码行数:13,
示例10: CR_thread_startint CR_thread_start( unsigned int n ){ nspawns = n; if ( m_state_get() == M_RESTART ) { ASSERT_MSG( restart_version >= 0, "Internal error" ); }#ifndef CR_FTB // This must be called before mpispawn are started // Do not move this to CR_Loop() if (USE_LINEAR_SSH) { if (!show_on) { int rv = create_connections(); if ( rv != 0 ) { return -1; } } }#endif struct timeval starting; gettimeofday(&starting, NULL); starting_time = last_ckpt = starting.tv_sec; // Check and set CR state CR_state_lock(); ASSERT_MSG( cr_state == CR_INIT || cr_state == CR_STOPPED, "Internal Error/n"); CR_state_transition_nolock( CR_INIT ); CR_state_unlock(); if (pthread_create(&cr_tid, NULL, CR_Loop, NULL) < 0) { PRINT_ERROR_ERRNO("pthread_create() failed", errno); cr_tid = 0; return -1; } return 0;}
开发者ID:hpc,项目名称:mvapich2-cce,代码行数:39,
示例11: RecvDataIsReady/** * DSP_DSP::RecvDataIsReady service function * This function checks whether a DSP register is ready to be read. * Inputs: * 1 : Register Number * Outputs: * 1 : Result of function, 0 on success, otherwise error code * 2 : non-zero == ready * Note: * This function has only been observed being called with a register number of 0. */static void RecvDataIsReady(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 register_number = cmd_buff[1]; ASSERT_MSG(register_number == 0, "Unknown register_number {}", register_number); cmd_buff[0] = IPC::MakeHeader(0x2, 2, 0); cmd_buff[1] = RESULT_SUCCESS.raw; cmd_buff[2] = 1; // Ready to read LOG_DEBUG(Service_DSP, "register_number=%u", register_number);}
开发者ID:DaMan69,项目名称:citra,代码行数:24,
示例12: kmallocvoid *kmalloc_pages(size_t npages){ void *p; p = kmalloc(npages * PAGE_SIZE); if (!p) return NULL; /* check page alignment in debug kernels */ ASSERT_MSG(!((addr_t)p % PAGE_SIZE), "allocated memory is not page aligned!/n"); return p;}
开发者ID:skarpenko,项目名称:phlox,代码行数:13,
示例13: ASSERT_MSGvoid Sound3D::assignChannel(SoundDevice& device){ if (m_channel != NULL) { ASSERT_MSG( false, "The 3d sound already has a channel assigned"); return; } m_channel = &(device.activateSound(m_sound)); onChannelAssigned(*m_channel); m_channel->setLooped(m_looped); m_channel->play();}
开发者ID:dabroz,项目名称:Tamy,代码行数:13,
示例14: get_type /** * Returns the type of the SArray (as set by * /ref swriter<flexible_type>::set_type). If the type of the SArray was * not set, this returns /ref flex_type_enum::UNDEFINED, in which case * each row can be of arbitrary type. * * This function should only be used for sarray<flexible_type> and * will fail fatally otherwise. */ flex_type_enum get_type() const { if (!std::is_same<T, flexible_type>::value) { ASSERT_MSG(false, "Use of get_type() in SArray which " "does not contain flexible_types"); } ASSERT_NE(reader, NULL); const index_file_information& index_info = reader->get_index_info(); if (index_info.metadata.count("__type__")) { return flex_type_enum::UNDEFINED; } return flex_type_enum(std::stoi(index_info.metadata.at("__type__"))); }
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:22,
示例15: ASSERT_MSG/* create user process */process_t *proc_create_user_process(const char *name, process_t *parent, vm_address_space_t *aspace, const char *args, uint role){ process_t *proc; ASSERT_MSG(name != NULL && strlen(name) <= SYS_MAX_OS_NAME_LEN, "proc_create_user_process: user process name is invalid!/n"); /* check args */ if(aspace == NULL || role > PROCESS_ROLES_COUNT) return NULL; /* create process struct */ proc = create_process_common(name, args); if(!proc) return INVALID_PROCESSID; /* init struct fields */ proc->aspace = vm_inc_aspace_refcnt(aspace); if(!proc->aspace) goto error_exit; if(parent) { proc->parent = proc_inc_refcnt(parent); if(!proc->parent) goto error_exit; } proc->aid = proc->aspace->id; proc->process_role = role; proc->def_prio = process_roles_props[proc->process_role].def_prio; proc->def_sched_policy.raw = process_roles_props[proc->process_role].def_sched_policy.raw; atomic_set((atomic_t*)&proc->ref_count, 1); /* already has one ref owned by caller */ /* init arch-dependend part */ if(arch_init_process_struct(proc) != NO_ERROR) goto error_exit; /* add to processes list */ put_process_to_list(proc); return proc; /* return to caller *//* exit on errors */error_exit: if(proc->aspace) vm_put_aspace(proc->aspace); if(proc->parent) proc_put_process(proc->parent); destroy_process_common(proc); return NULL;}
开发者ID:skarpenko,项目名称:phlox,代码行数:52,
示例16: QStringvoid MainEditorPanel::saveLayout( QSettings& outSettings ){ char tmpEditorGroupStr[32]; outSettings.beginGroup( "MainEditorPanel/activeEditors" ); // first - serialize the active project's path, if there's one Project* activeProject = TamyEditor::getInstance().getActiveProject(); if ( activeProject ) { FilePath projectPath = activeProject->getFilePath(); outSettings.setValue( "activeProjectPath", QString( projectPath.c_str() ) ); } // if there's an active project, serialize the active editors ( editors may work only in the project scope ) if ( activeProject ) { std::vector< ResourceEditor* > editors; std::vector< TabLocation > tabsLocations; collectEditors( editors, &tabsLocations ); uint count = editors.size(); outSettings.setValue( "editorsCount", count ); for ( uint i = 0; i < count; ++i ) { ResourceEditor* editor = editors[i]; // create a new group for each editor sprintf( tmpEditorGroupStr, "editor_%d", i ); outSettings.beginGroup( tmpEditorGroupStr ); { // save the layout data outSettings.setValue( "internal", tabsLocations[i].m_internal ); if ( tabsLocations[i].m_internal == false ) { QWidget* parentWidget = editor->parentWidget(); ASSERT_MSG( dynamic_cast< QDockWidget* >( parentWidget ), "A detached ResourceEditor is expected to be embedded in a QDockWidget" ); QDockWidget* parentDockWidget = static_cast< QDockWidget* >( parentWidget ); Qt::DockWidgetArea dockArea = m_mainWindow->dockWidgetArea( parentDockWidget ); outSettings.setValue( "dockArea", (int)dockArea ); } outSettings.setValue( "path", editor->getLabel() ); outSettings.setValue( "icon", editor->getIcon().name() ); } outSettings.endGroup(); } } outSettings.endGroup();}
开发者ID:chenwenbin928,项目名称:tamy,代码行数:51,
示例17: ASSERTvoid SceneGraph::AddNode(ISceneNode* pNode){ ASSERT(pNode); ASSERT_MSG(!pNode->mRemoveNodePostUpdate, "Probably got scheduled for remove then added in same frame"); //@LAME: Because we multiply inherit ISceneNode and IPhysical, we need to do this here if (IPhysical* pPhysical = DynamicCast<IPhysical*>(pNode)) { mPhysicalList.push_back(pPhysical); } mSceneNodeList.push_back(pNode); pNode->OnAddToScene();}
开发者ID:amaiorano,项目名称:ZeldaDS,代码行数:14,
示例18: GetHomeDirectory/** * @return The user’s home directory on POSIX systems */static const std::string& GetHomeDirectory() { static std::string home_path; if (home_path.empty()) { const char* envvar = getenv("HOME"); if (envvar) { home_path = envvar; } else { auto pw = getpwuid(getuid()); ASSERT_MSG(pw, "$HOME isn’t defined, and the current user can’t be found in /etc/passwd."); home_path = pw->pw_dir; } } return home_path;}
开发者ID:Glought,项目名称:citra,代码行数:17,
示例19: MDLSetMaterial/////////////////////////////////////// Name: MDLSetMaterial// Purpose: sets/change model's// texture within material// index// Output: model's texture change// Return: RETCODE_SUCCESS if success/////////////////////////////////////PUBLIC RETCODE MDLSetMaterial(hMDL model, int materialInd, const GFXMATERIAL &material){ //allocate materials if there is none //set it automatically to one if(model->numMaterial == 0) { model->numMaterial = 1; model->materials = (GFXMATERIAL*)GFX_MALLOC(sizeof(GFXMATERIAL)*model->numMaterial); if(!model->materials) { ASSERT_MSG(0, "Unable to allocate model materials", "Error in MDLSetMaterial"); return RETCODE_FAILURE; } memcpy(&model->materials[0], &material, sizeof(GFXMATERIAL)); } else { if(materialInd >= model->numMaterial) { ASSERT_MSG(0, "Bad material index", "Error in MDLSetMaterial"); return RETCODE_FAILURE; } memcpy(&model->materials[materialInd], &material, sizeof(GFXMATERIAL)); } return RETCODE_SUCCESS;}
开发者ID:ddionisio,项目名称:TaTaMahatta,代码行数:31,
示例20: sizeof template <typename F> void GpuFFTPlanCl<F>::doExecute (const cl::CommandQueue& queue, const cl::Buffer& input, csize_t inputOffset, const cl::Buffer& output, csize_t outputOffset, bool doForward) const { if (supportNonZeroOffsets) { if (inputOffset != 0 || outputOffset != 0) { queue.enqueueCopyBuffer (input, tmp.getDataWritable (), (inputOffset * sizeof (std::complex<F>)) (), 0, (csize_t (sizeof (std::complex<F>)) * this->batchSize ()).value ()); doExecute (queue, tmp.getDataWritable (), 0, tmp.getDataWritable (), 0, doForward); queue.enqueueCopyBuffer (tmp.getData (), output, 0, (outputOffset * sizeof (std::complex<F>)) (), (csize_t (sizeof (std::complex<F>)) * this->batchSize ()).value ()); return; } } else { ASSERT_MSG (inputOffset == 0, "not implemented"); ASSERT_MSG (outputOffset == 0, "not implemented"); } if (this->size () == 0) return; if (this->size () == 1) { if (input () != output ()) queue.enqueueCopyBuffer (input, output, 0, 0, (csize_t (sizeof (std::complex<F>)) * this->batchCount ()).value ()); return; } cl::detail::errHandler (VAL(ExecuteInterleaved) (queue (), static_cast<TY(Plan)> (plan), Core::checked_cast<int> (this->batchCount ()), doForward ? VAL(Forward) : VAL(Inverse), input (), output (), 0, NULL, NULL), VAL(ExecuteInterleavedStr)); }
开发者ID:steffen-kiess,项目名称:dda,代码行数:23,
示例21: OBJSetMaterial/////////////////////////////////////// Name: OBJSetMaterial// Purpose: change obj's// material within material// index// Output: obj's material change// Return: RETCODE_SUCCESS if success/////////////////////////////////////PUBLIC RETCODE OBJSetMaterial(hOBJ obj, int materialInd, const GFXMATERIAL * material){ //allocate materials if there is none //set it automatically to one if(obj->theMdl->numMaterial > 0) { if(materialInd >= obj->theMdl->numMaterial) { ASSERT_MSG(0, "Bad material index", "Error in OBJSetMaterial"); return RETCODE_FAILURE; } memcpy(&obj->materials[materialInd], material, sizeof(GFXMATERIAL)); } return RETCODE_SUCCESS;}
开发者ID:ddionisio,项目名称:TaTaMahatta,代码行数:22,
示例22: subprocess_callbackstatic void subprocess_callback(void *vdata) { struct subprocess_callback_data *dt = (struct subprocess_callback_data*)vdata; if (!dt->callback) return; lua_State *L = dt->L; // This may be called from C code with a dirty stack luaL_checkstack(L, 4, "Not enough stack space to call subprocess callback"); int handler = push_err_handler(L); extract_registry_value(L, dt->callback); int result = lua_pcall(L, 0, 0, handler); ASSERT_MSG(!result, "%s", interpreter_error_result(L));}
开发者ID:CZ-NIC,项目名称:turris-updater,代码行数:14,
示例23: ScriptVarCreate/////////////////////////////////////// Name: ScriptVarCreate// Purpose: create a variable from file// Output: variable added to global list// if bGlobal == true// Return: new variable/////////////////////////////////////PROTECTED hVAR ScriptVarCreate(void *owner, FILE *fp, const ScriptInd & sInd, bool bGlobal){ hVAR newVar = (hVAR)SCRIPT_MALLOC(sizeof(Variable)); if(!newVar) { ASSERT_MSG(0, "Unable to allocate new variable!", "ScriptVarCreate"); return 0; } //set type newVar->type = sInd; //get name from file ParserReadWordFile(fp, newVar->name, MAXCHARNAME, 0); if(ScriptVarCall(owner, newVar, VAR_CREATE, 0, 0) != RETCODE_SUCCESS) { ASSERT_MSG(0, "Error initializing new variable!", "ScriptVarCreate"); ScriptVarDestroy(owner, &newVar); return 0; } //add to global if bGlobal is true if(bGlobal) { ScriptTeaseAddGlobalVar(newVar); } return newVar;}
开发者ID:ddionisio,项目名称:TaTaMahatta,代码行数:30,
示例24: operator T* operator()(ComponentBase* component) const { ASSERT(component != nullptr); T* result;#ifndef NDEBUG result = dynamic_cast<T*>(component); ASSERT_MSG(result != nullptr, "Component has invalid family.");#else // AFAIK, static_cast produces undefined behavior if // T isn't a subclass of ComponentBase. result = static_cast<T*>(component);#endif return result; }
开发者ID:leod,项目名称:game,代码行数:14,
示例25: event_nudgestatic voidevent_nudge(void *drcontext, uint64 arg){ dr_fprintf(STDERR, "nudge delivered %x/n", (uint)arg); if (arg == NUDGE_ARG_SELF) dr_fprintf(STDERR, "self/n"); else if (arg == NUDGE_ARG_PRINT) dr_fprintf(STDERR, "printing/n"); else if (arg == NUDGE_ARG_TERMINATE) { dr_fprintf(STDERR, "terminating/n"); dr_exit_process(NUDGE_TERMINATE_STATUS); ASSERT_MSG(false, "should not be reached"); }}
开发者ID:Arunpreet,项目名称:dynamorio,代码行数:14,
示例26: ASSERT///////////////////////////////////////////////////////////////////////////////// Descripcion:// - Alinea a la criatura en el mismo conjunto en donde este alineada // la criatura hCriatureFriend. En caso de que dicha criatura no este// alineada en ningun grupo, la alineacion no se llevara a cabo.// Parametros:// - hCriature. Entidad a la que se desea alinear.// - hCriatureFriend. Entidad con la que se desea alinear.// Devuelve:// - Si ha sido posible realizar la operacion true. En caso contrario false.// Notas:///////////////////////////////////////////////////////////////////////////////boolCCombatSystem::SetAlingmentWith(const AreaDefs::EntHandle& hCriature, const AreaDefs::EntHandle& hCriatureFriend){ // SOLO si insancia inicializada ASSERT(IsInitOk()); // SOLO si parametros validos ASSERT_MSG(IsValidCombatient(hCriature), "SetAlingmentWith_1"); ASSERT_MSG(IsValidCombatient(hCriatureFriend), "SetAlingmentWith_2"); // Se obtiene la alineacion de hCriatureFriend const CombatSystemDefs::eCombatAlingment FriendAlingment = GetAlingment(hCriatureFriend); // C++ ASSERT_ND函数代码示例 C++ ASSERT_MESSAGE函数代码示例
|