当前位置: 首页>>代码示例>>C++>>正文


C++ ASSERT_NULL函数代码示例

本文整理汇总了C++中ASSERT_NULL函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_NULL函数的具体用法?C++ ASSERT_NULL怎么用?C++ ASSERT_NULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ASSERT_NULL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_create_destroy_writer

void test_create_destroy_writer(void)
{
    kaa_platform_message_writer_t *writer = NULL;
    char buffer[16];
    size_t buffer_size = sizeof(buffer) / sizeof(char);

    kaa_error_t error_code = KAA_ERR_NONE;
    error_code = kaa_platform_message_writer_create(NULL, buffer, buffer_size);
    ASSERT_EQUAL(error_code, KAA_ERR_BADPARAM);
    ASSERT_NULL(writer);

    error_code = kaa_platform_message_writer_create(&writer, NULL, buffer_size);
    ASSERT_EQUAL(error_code, KAA_ERR_BADPARAM);
    ASSERT_NULL(writer);

    error_code = kaa_platform_message_writer_create(&writer, buffer, 0);
    ASSERT_EQUAL(error_code, KAA_ERR_BADPARAM);
    ASSERT_NULL(writer);

    error_code = kaa_platform_message_writer_create(&writer, buffer, buffer_size);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NOT_NULL(writer);
    ASSERT_EQUAL((writer->end - writer->begin), buffer_size);
    ASSERT_EQUAL(writer->begin, writer->current);

    kaa_platform_message_writer_destroy(writer);
}
开发者ID:ikbelkirasan,项目名称:kaa,代码行数:27,代码来源:test_platform_utils.c

示例2: test_string_move_create

static void test_string_move_create(void **state)
{
    (void)state;

    ASSERT_NULL(kaa_string_move_create(NULL, NULL));

    const char *plain_test_str1 = "test";

    kaa_string_t *kaa_str1 = kaa_string_move_create(plain_test_str1, NULL);

    ASSERT_NOT_NULL(kaa_str1);
    ASSERT_NOT_NULL(kaa_str1->data);
    ASSERT_NULL(kaa_str1->destroy);
    ASSERT_EQUAL(strcmp(kaa_str1->data, plain_test_str1), 0);

    kaa_string_destroy(kaa_str1);
    kaa_str1 = NULL;

    char *plain_test_str2 = (char *)KAA_MALLOC(strlen(plain_test_str1) + 1);
    ASSERT_NOT_NULL(plain_test_str2);
    strcpy(plain_test_str2, plain_test_str1);

    kaa_string_t *kaa_str2 = kaa_string_move_create(plain_test_str2, &kaa_data_destroy);

    ASSERT_NOT_NULL(kaa_str2);
    ASSERT_NOT_NULL(kaa_str2->data);
    ASSERT_EQUAL(kaa_str2->destroy, &kaa_data_destroy);
    ASSERT_EQUAL(strcmp(kaa_str2->data, plain_test_str1), 0);

    kaa_string_destroy(kaa_str2);
}
开发者ID:Kirill380,项目名称:kaa,代码行数:31,代码来源:test_kaa_common_schema.c

示例3: ASSERT_NULL

BOOL ISprite::Load(const char *filename, ResourceManager *res, IMemoryPool *pool)
{
	ASSERT_NULL(pool);
	ASSERT_NULL(filename);
	ASSERT_NULL(res);

	if (this->Unload())
	{
		pFilename = filename;
		pPool = pool;
		pRes = res;

		pSprite = static_cast<SpriteObject *>(res->Get(filename, Seed::ObjectSprite, pool));
		this->SetRotation(0);
		this->SetAnimation(0u);

		bChanged = TRUE;
		bInitialized = TRUE;

		pAnimation = pSprite->GetAnimation(iCurrentAnimation);
		pAnimationFrames = pSprite->GetFrames(pAnimation);
		pFrame = &pAnimationFrames[iCurrentFrame];
	}

	return TRUE;
}
开发者ID:fungos,项目名称:seed1,代码行数:26,代码来源:ISprite.cpp

示例4: UNUSED

BOOL Texture::Load(const char *filename, ResourceManager *res, IMemoryPool *pool)
{
	UNUSED(res);
	UNUSED(pool);
	ASSERT_NULL(res);
	ASSERT_NULL(filename);
	ASSERT_NULL(pool);

	if (this->Unload())
	{
		image = QImage(filename);

		if (image.isNull())
		{
			return FALSE;
		}

		image = image.convertToFormat(QImage::Format_ARGB32);

		iWidth = image.width();
		iHeight = image.height();

		iAtlasWidth = iWidth;
		iAtlasHeight = iHeight;
		//iHalfWidth = iWidth >> 1;
		//iHalfHeight = iHeight >> 1;

		fWidth = (f32)iWidth / (f32)pScreen->GetWidth();
		fHeight = (f32)iHeight / (f32)pScreen->GetHeight();
	}

	return TRUE;
}
开发者ID:doorxp,项目名称:seed,代码行数:33,代码来源:QtTexture.cpp

示例5: mon_init

PERIODIC_THREAD_END


void mon_init(void)
{
   ASSERT_ONCE();

   /* open monitoring socket: */
   mon_socket = scl_get_socket("ap_mon");
   ASSERT_NOT_NULL(mon_socket);
   int64_t hwm = 1;
   zmq_setsockopt(mon_socket, ZMQ_SNDHWM, &hwm, sizeof(hwm));

   /* create monitoring connection: */
   const struct timespec period = {0, 20 * NSEC_PER_MSEC};
   pthread_mutexattr_init(&mutexattr);
   pthread_mutexattr_setprotocol(&mutexattr, PTHREAD_PRIO_INHERIT);
   pthread_mutex_init(&mutex, &mutexattr);

   /* init msgpack buffer: */
   ASSERT_NULL(msgpack_buf);
   msgpack_buf = msgpack_sbuffer_new();
   ASSERT_NOT_NULL(msgpack_buf);
   ASSERT_NULL(pk);
   pk = msgpack_packer_new(msgpack_buf, msgpack_sbuffer_write);

   periodic_thread_start(&emitter_thread, mon_emitter, "mon_thread", THREAD_PRIORITY, period, NULL);
}
开发者ID:Aerobota,项目名称:PenguPilot,代码行数:28,代码来源:mon.c

示例6: ASSERT_NULL

    void StackTest::testPushPopTopSize()
    {
        adt::Stack<int> stack;

        ASSERT_NULL(stack.top());
        ASSERT_NULL(stack.pop());
        ASSERT_EQUAL(static_cast<size_t>(0), stack.size());

        size_t stackSizeToTest = adt::Stack<int>::DEFAULT_RESERVED_SIZE * 2 + 1;
        for (int n = 1; static_cast<size_t>(n) <= stackSizeToTest; n++)
        {
            std::stringstream detail;
            detail << "n: " << n;
            stack.push(n);
            ASSERT_EQUAL_DETAIL(static_cast<size_t>(n), stack.size(), detail);
        }

        for (int n = stackSizeToTest; static_cast<size_t>(n) > 0; n--)
        {
            std::stringstream detail;
            detail << "n: " << n;
            const int* lastTop = stack.pop();
            ASSERT_NOT_NULL(lastTop);
            if (lastTop)
            {
                ASSERT_EQUAL_DETAIL(n, *lastTop, detail);
            }
        }

        ASSERT_NULL(stack.top());
        ASSERT_NULL(stack.pop());
        ASSERT_EQUAL(static_cast<size_t>(0), stack.size());
    }
开发者ID:jwilges,项目名称:samples,代码行数:33,代码来源:stacktest.cpp

示例7: ASSERT_NULL

BOOL IFileSystem::Open(const char *fileName, File *file, IMemoryPool *pool)
{
	ASSERT_NULL(fileName);
	ASSERT_NULL(file);
	ASSERT_NULL(pool);

	BOOL ret = FALSE;

	file->pName = NULL;
	file->pData = NULL;
	file->pPool = NULL;
	file->iSize = 0;
	file->bPackaged = FALSE;

	if (pPackageManager->IsInitialized())
	{
		file->pData = pPackageManager->GetFile(fileName, &file->iSize);

		if (file->pData)
		{
			ret = TRUE;
			file->pName = fileName;
			file->pPool = pool;
			file->bPackaged = TRUE;
		}
	}

	return ret;
}
开发者ID:Patuti,项目名称:seed,代码行数:29,代码来源:IFileSystem.cpp

示例8: ASSERT_NULL

void WidgetContainer::OnInputPointerMove(const EventInputPointer *ev)
{
	ASSERT_NULL(ev);

	WidgetIterator it = vWidget.begin();
	WidgetIterator end = vWidget.end();

	for (; it != end; ++it)
	{
		IWidget *w = (*it);
		ASSERT_NULL(w);

		bEventConsumed = FALSE;

		if (w->IsDisabled())
			continue;

		if (w->GetObjectType() == Seed::ObjectGuiWidgetContainer)
		{
			WidgetContainer *wc = reinterpret_cast<WidgetContainer *>(w);
			wc->OnInputPointerMove(ev);

			bEventConsumed = wc->IsEventConsumed();
			if (bEventConsumed)
				break;
		}

		bEventConsumed = this->UpdateStates(ev, w);
		//if (UpdateStates(ev, w))
		if (bEventConsumed)
			break;
	}
}
开发者ID:doorxp,项目名称:seed,代码行数:33,代码来源:WidgetContainer.cpp

示例9: test_kaa_deque_first_last

void test_kaa_deque_first_last()
{
    kaa_error_t error_code = KAA_ERR_NONE;

    error_code = kaa_deque_first(NULL, NULL);
    ASSERT_EQUAL(error_code, KAA_ERR_BADPARAM);
    error_code = kaa_deque_last(NULL, NULL);
    ASSERT_EQUAL(error_code, KAA_ERR_BADPARAM);

    kaa_deque_t *deque = NULL;
    error_code = kaa_deque_create(&deque);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NOT_NULL(deque);

    error_code = kaa_deque_first(deque, NULL);
    ASSERT_EQUAL(error_code, KAA_ERR_BADPARAM);
    error_code = kaa_deque_last(deque, NULL);
    ASSERT_EQUAL(error_code, KAA_ERR_BADPARAM);

    kaa_deque_iterator_t *it = NULL;
    error_code = kaa_deque_first(NULL, &it);
    ASSERT_EQUAL(error_code, KAA_ERR_BADPARAM);
    error_code = kaa_deque_last(NULL, &it);
    ASSERT_EQUAL(error_code, KAA_ERR_BADPARAM);

    error_code = kaa_deque_first(deque, &it);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NULL(it);
    error_code = kaa_deque_last(deque, &it);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NULL(it);

    kaa_deque_push_back_data(deque, "data");
    ASSERT_EQUAL(kaa_deque_size(deque), 1);

    kaa_deque_iterator_t *it1 = NULL;
    error_code = kaa_deque_first(deque, &it1);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NOT_NULL(it1);
    kaa_deque_iterator_t *it2 = NULL;
    error_code = kaa_deque_last(deque, &it2);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NOT_NULL(it2);
    ASSERT_EQUAL(it1, it2);

    kaa_deque_push_back_data(deque, "data");
    ASSERT_EQUAL(kaa_deque_size(deque), 2);

    error_code = kaa_deque_first(deque, &it1);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NOT_NULL(it1);

    error_code = kaa_deque_last(deque, &it2);
    ASSERT_EQUAL(error_code, KAA_ERR_NONE);
    ASSERT_NOT_NULL(it2);
    ASSERT_NOT_EQUAL(it1, it2);

    kaa_deque_destroy(deque, &test_kaa_deque_destroy_stub);
}
开发者ID:BioSoundSystems,项目名称:kaa,代码行数:59,代码来源:test_kaa_deque.c

示例10: ASSERT_NULL

BOOL Font::Load(const char *filename, ResourceManager *res, IMemoryPool *pool)
{
	ASSERT_NULL(filename);
	ASSERT_NULL(res);
	ASSERT_NULL(pool);

	if (this->Unload())
	{
		this->pFilename = filename;
		this->pRes = res;
		this->pPool = pool;

		stFile.Close();
		SECURITY_CHECK(pFileSystem->Open(filename, &stFile, pool), "Could not open font file.");
		const u8 *ptr = static_cast<const u8 *>(stFile.GetData());
		ObjectHeader *block = NULL;
		READ_STRUCT(block, ObjectHeader, ptr);
		SECURITY_CHECK(seed_validate_block(&stFile, block, FONT_OBJECT_MAGIC, FONT_OBJECT_VERSION), "Invalid block header for font.");

		READ_F32(this->fTracking, ptr);
		READ_F32(this->fSpacing, ptr);
		READ_F32(this->fSpaceWidth, ptr);

	/*
		const char *file = NULL;
		READ_STR(file, ptr);
		ASSERT_NULL(file);

		const char *ext = NULL;
		READ_STR(ext, ptr);
	*/
		u32 file = 0;
		READ_U32(file, ptr);

		u32 ext = 0;
		READ_U32(ext, ptr);

		if (ext != SEED_INVALID_ID /*&& pSystem->GetLanguage() != Seed::en_US*/)
		{
			File extf;
			if (pFileSystem->Open(_F(ext), &extf, pool))
			{
				extf.Close();
				this->mFontExt.Load(_F(ext), res, pool);
				this->pGlyphs = pDictionary->GetGlyphTable(&this->iTotalGlyphs);
			}
		}

		this->mFont.Load(_F(file), res, pool);
		this->fHeight	= mFont.GetHeight();
		this->fWidth	= mFont.GetWidth();

		this->bLoaded	= TRUE;
	}

	return bLoaded;
}
开发者ID:doorxp,项目名称:seed,代码行数:57,代码来源:Font.cpp

示例11: ASSERT_NULL

void TerrainEffectorPropertytest::test_none_found()
{
    ASSERT_NULL(m_world->m_location.m_loc);
    ASSERT_EQUAL(m_entity->m_location.m_loc, m_world);

    const TerrainProperty * res = m_property->getTerrain(m_entity);

    ASSERT_NULL(res);
}
开发者ID:cyclefusion,项目名称:cyphesis,代码行数:9,代码来源:TerrainEffectorPropertytest.cpp

示例12: ASSERT_NULL

void IInputJoystick::SendEventJoystickDPadMove(const EventInputJoystick *ev)
{
	ASSERT_NULL(ev);

	for (u32 i = 0; i < arJoystickListeners.Size(); i++)
	{
		ASSERT_NULL(arJoystickListeners[i]);
		arJoystickListeners[i]->OnInputJoystickDPadMove(ev);
	}
}
开发者ID:doorxp,项目名称:seed,代码行数:10,代码来源:IInputJoystick.cpp

示例13: test_list_create

static void test_list_create()
{
    kaa_list_t *list = kaa_list_create();
    ASSERT_NOT_NULL(list);

    ASSERT_EQUAL(kaa_list_get_size(list), 0);
    ASSERT_NULL(kaa_list_begin(list));
    ASSERT_NULL(kaa_list_back(list));

    kaa_list_destroy(list, NULL);
}
开发者ID:Acarus,项目名称:kaa,代码行数:11,代码来源:test_kaa_list.c

示例14: CTEST2

CTEST2(tube, manager_getset_data)
{
	tube_manager *mgr = data->mgr;
	char mgr_data[] = "the manager data";

	ASSERT_NULL( tube_manager_get_data(mgr) );
	tube_manager_set_data(mgr, mgr_data);
	ASSERT_TRUE( tube_manager_get_data(mgr)== mgr_data );
	tube_manager_set_data(mgr, NULL);
	ASSERT_NULL( tube_manager_get_data(mgr) );
}
开发者ID:thomas-fossati,项目名称:SPUDlib,代码行数:11,代码来源:tube_test.c

示例15: CTEST

CTEST(ls_htable, basics)
{
  ls_htable* table;
  ls_err     err;
  ASSERT_TRUE( ls_htable_create(7,
                                ls_str_hashcode,
                                ls_str_compare,
                                &table,
                                &err) );

  ASSERT_EQUAL(ls_htable_get_count(table), 0);
  ASSERT_NULL( ls_htable_get(table, "key1") );
  ASSERT_NULL( ls_htable_get(table, "key2") );

  pvalue = NULL;
  ASSERT_TRUE( ls_htable_put(table, "key1", "value one",
                             test_htable_store_pvalue, &err) );
  ASSERT_NULL(pvalue);
  ASSERT_EQUAL(ls_htable_get_count(table),                        1);
  ASSERT_EQUAL(strcmp(ls_htable_get(table, "key1"), "value one"), 0);
  ASSERT_NULL( ls_htable_get(table, "key2") );

  ASSERT_TRUE( ls_htable_put(table, "key2", "value two",
                             test_htable_store_pvalue, &err) );
  ASSERT_NULL(pvalue);
  ASSERT_EQUAL(ls_htable_get_count(table),                        2);
  ASSERT_EQUAL(strcmp(ls_htable_get(table, "key1"), "value one"), 0);
  ASSERT_EQUAL(strcmp(ls_htable_get(table, "key2"), "value two"), 0);

  ASSERT_TRUE( ls_htable_put(table, "key1", "val 1", test_htable_store_pvalue,
                             &err) );
  ASSERT_EQUAL(strcmp( (const char*)pvalue, "value one" ),        0);
  ASSERT_EQUAL(ls_htable_get_count(table),                        2);
  ASSERT_EQUAL(strcmp(ls_htable_get(table, "key1"), "val 1"),     0);
  ASSERT_EQUAL(strcmp(ls_htable_get(table, "key2"), "value two"), 0);

  pvalue = NULL;
  ls_htable_remove(table, "key1");
  ASSERT_EQUAL(strcmp(pvalue, "val 1"),    0);
  ASSERT_EQUAL(ls_htable_get_count(table), 1);
  ASSERT_NULL( ls_htable_get(table, "key1") );
  ASSERT_EQUAL(strcmp(ls_htable_get(table, "key2"), "value two"), 0);

  pvalue = NULL;
  ASSERT_TRUE( ls_htable_put(table, "key1", "first value",
                             test_htable_store_pvalue, &err) );
  ASSERT_NULL(pvalue);
  ASSERT_EQUAL(ls_htable_get_count(table),                          2);
  ASSERT_EQUAL(strcmp(ls_htable_get(table, "key1"), "first value"), 0);
  ASSERT_EQUAL(strcmp(ls_htable_get(table, "key2"), "value two"),   0);

  ls_htable_clear(table);
  ASSERT_EQUAL(ls_htable_get_count(table), 0);
  ASSERT_NULL( ls_htable_get(table, "key1") );
  ASSERT_NULL( ls_htable_get(table, "key2") );

  ls_htable_destroy(table);
}
开发者ID:britram,项目名称:SPUDlib,代码行数:58,代码来源:ls_htable_test.c


注:本文中的ASSERT_NULL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。