test_osapi_memory.c

来自「这是DVD中伺服部分的核心代码」· C语言 代码 · 共 60 行

C
60
字号
/*****************************************************************************
******************************************************************************
**                                                                          **
**  Copyright (c) 2006 Videon Central, Inc.                                 **
**  All rights reserved.                                                    **
**                                                                          **
**  The computer program contained herein contains proprietary information  **
**  which is the property of Videon Central, Inc.  The program may be used  **
**  and/or copied only with the written permission of Videon Central, Inc.  **
**  or in accordance with the terms and conditions stipulated in the        **
**  agreement/contract under which the programs have been supplied.         **
**                                                                          **
******************************************************************************
*****************************************************************************/
/**
 * @file test_osapi_memory.c
 *
 * $Revision: 1.3 $ 
 *
 * Operating System API (OSAPI) test file. 
 *
 *
 */

#include "vdvd_types.h"
#include "osapi.h"
#include "dbgprint.h"
#include "test_osapi.h"

void OSAPIMemoryTests( void )
{
    PVOID       pMemory;
    OS_STATUS   status;

    DbgPrint(("\nOSAPI MEMORY TEST\n"));

    DbgPrint(("[running] Test 1: allocate memory of size 0"));
    pMemory = OS_MemAlloc(0);
    PassFail( (pMemory==NULL) );

    DbgPrint(("[running] Test 2: free NULL pointer"));
    status = OS_MemFree(NULL);
    PassFail( (status!=OS_OK) );

    DbgPrint(("[running] Test 3: allocate memory of size 1KB"));
    pMemory = OS_MemAlloc(1024);
    PassFail( (pMemory!=NULL) );

    DbgPrint(("[running] Test 4: free memory of size 1KB"));
    status = OS_MemFree(pMemory);
    PassFail( (status==OS_OK) );

    pMemory = NULL;

    DbgPrint(("\nOSAPI MEMORY TEST FINISHED\n"));
}



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?