亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cuerror.c

?? CUNIT c 測試框架,類似大名鼎鼎的junit,很有用的,這里是原代碼,可以編譯生成lib文件
?? C
字號:
/*
 *  CUnit - A Unit testing framework library for C.
 *  Copyright (C) 2001            Anil Kumar
 *  Copyright (C) 2004,2005,2006  Anil Kumar, Jerry St.Clair
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 *  Error handling code used by CUnit
 *
 *  16-Jul-2004   Created access functions for error code, error action 
 *                functions, messages for new error codes. (JDS)
 */

/** @file
 * Error handling functions (implementation).
 */
/** @addtogroup Framework
 @{
*/

#include <stdio.h>
#include <stdlib.h>

#include "CUError.h"

/*
 *	Global/Static Definitions
 */
/** Local variable holding the current error code. */
static CU_ErrorCode g_error_number = CUE_SUCCESS;
/** Local variable holding the current error action code. */
static CU_ErrorAction g_error_action = CUEA_IGNORE;

/* Private function forward declarations */
static const char* get_error_desc(CU_ErrorCode error);

#ifdef CUNIT_DO_NOT_DEFINE_UNLESS_BUILDING_TESTS
void test_exit(int status);
#endif

/*------------------------------------------------------------------------*/
/** Set the error code.
 * This function is used internally by CUnit implementation functions
 * when an error condition occurs within the framework.  It should
 * not generally be called by user code.  NOTE that if the current
 * error action is CUEA_ABORT, then calling this function will
 * result in exit() being called for the current application.
 * @param error CU_ErrorCode indicating the current error condition.
 * @see CU_get_error()
 * @see CU_get_error_msg()
 * @see CU_ErrorCode
 */
void CU_set_error(CU_ErrorCode error)
{
  if ((error != CUE_SUCCESS) && (g_error_action == CUEA_ABORT)) {
#ifndef CUNIT_DO_NOT_DEFINE_UNLESS_BUILDING_TESTS
    fprintf(stderr, "\nAborting due to error #%d: %s\n",
            (int)error,
            get_error_desc(error));
    exit((int)error);
#else
    test_exit(error);
#endif
  }

  g_error_number = error;
}

/*------------------------------------------------------------------------*/
/** Get the error code.
 * CUnit implementation functions set the error code to indicate the
 * status of the most recent operation.  In general, the CUnit functions
 * will clear the code to CUE_SUCCESS, then reset it to a specific error
 * code if an exception condition is encountered.  Some functions
 * return the code, others leave it to the user to inspect if desired.
 * @return The current error condition code.
 * @see CU_get_error_msg()
 * @see CU_ErrorCode
 */
CU_ErrorCode CU_get_error(void)
{
	return g_error_number;
}

/*------------------------------------------------------------------------*/
/** Get the message corresponding to the error code.
 * CUnit implementation functions set the error code to indicate the
 * of the most recent operation.  In general, the CUnit functions will
 * clear the code to CUE_SUCCESS, then reset it to a specific error
 * code if an exception condition is encountered.  This function allows
 * the user to retrieve a descriptive error message corresponding to the
 * error code set by the last operation.
 * @return A message corresponding to the current error condition.
 * @see CU_get_error()
 * @see CU_ErrorCode
 */
const char* CU_get_error_msg(void)
{
	return get_error_desc(g_error_number);
}

/*------------------------------------------------------------------------*/
/** Set the action to take when an error condition occurs.
 * This function should be used to specify the action to take
 * when an error condition is encountered.  The default action is
 * CUEA_IGNORE, which results in errors being ignored and test runs
 * being continued (if possible).  A value of CUEA_FAIL causes test
 * runs to stop as soon as an error condition occurs, while
 * CU_ABORT causes the application to exit on any error.
 * @param action CU_ErrorAction indicating the new error action.
 * @see CU_get_error_action()
 * @see CU_set_error()
 * @see CU_ErrorAction
 */
void CU_set_error_action(CU_ErrorAction action)
{
  g_error_action = action;
}

/*------------------------------------------------------------------------*/
/** Get the current error action code.
 * @return The current error action code.
 * @see CU_set_error_action()
 * @see CU_set_error()
 * @see CU_ErrorAction
 */
CU_ErrorAction CU_get_error_action(void)
{
  return g_error_action;
}

/*
 * Private static function definitions
 */
/*------------------------------------------------------------------------*/
/** Internal function to look up the error message for a specified
 * error code.  An empty string is returned if iError is not a member
 * of CU_ErrorCode.
 * @param iError  CU_ErrorCode to look up.
 * @return Pointer to a string containing the error message.
 * @see CU_get_error_msg()
 */
static const char* get_error_desc(CU_ErrorCode iError)
{
  int iMaxIndex;

  static const char* ErrorDescription[] = {
    "No Error",                             /* CUE_SUCCESS - 0 */
    "Memory allocation failed.",            /* CUE_NOMEMORY - 1 */
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "Test registry does not exist.",          /* CUE_NOREGISTRY - 10 */
    "Registry already exists.",               /* CUE_REGISTRY_EXISTS - 11 */
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "NULL suite not allowed.",                /* CUE_NOSUITE - 20 */
    "Suite name cannot be NULL.",             /* CUE_NO_SUITENAME - 21 */
    "Suite initialization function failed.",  /* CUE_SINIT_FAILED - 22 */
    "Suite cleanup function failed.",         /* CUE_SCLEAN_FAILED - 23 */
    "Suite having name already registered.",  /* CUE_DUP_SUITE - 24 */
    "",
    "",
    "",
    "",
    "",
    "NULL test not allowed.",                 /* CUE_NOTEST - 30 */
    "Test name cannot be NULL.",              /* CUE_NO_TESTNAME - 31 */
    "Test having this name already in suite.",/* CUE_DUP_TEST - 32 */
    "Test not registered in specified suite.",/* CUE_TEST_NOT_IN_SUITE - 33 */
    "",
    "",
    "",
    "",
    "",
    "",
    "Error opening file.",                    /* CUE_FOPEN_FAILED - 40 */
    "Error closing file.",                    /* CUE_FCLOSE_FAILED - 41 */
    "Bad file name.",                         /* CUE_BAD_FILENAME - 42 */
    "Error during write to file.",            /* CUE_WRITE_ERROR - 43 */
    "Undefined Error"
  };

  iMaxIndex = (int)(sizeof(ErrorDescription)/sizeof(char *) - 1);
  if ((int)iError < 0) {
    return ErrorDescription[0];
  }
  else if ((int)iError > iMaxIndex) {
    return ErrorDescription[iMaxIndex];
  }
  else {
    return ErrorDescription[(int)iError];
  }
}

/** @} */

#ifdef CUNIT_BUILD_TESTS
#include "test_cunit.h"

void test_cunit_CUError(void)
{
  CU_ErrorCode old_err = CU_get_error();
  CU_ErrorAction old_action = CU_get_error_action();

  test_cunit_start_tests("CUError.c");

  /* CU_set_error() & CU_get_error() */
  CU_set_error(CUE_NOMEMORY);
  TEST(CU_get_error() != CUE_SUCCESS);
  TEST(CU_get_error() == CUE_NOMEMORY);

  CU_set_error(CUE_NOREGISTRY);
  TEST(CU_get_error() != CUE_SUCCESS);
  TEST(CU_get_error() == CUE_NOREGISTRY);

  /* CU_get_error_msg() */
  CU_set_error(CUE_SUCCESS);
  TEST(!strcmp(CU_get_error_msg(), get_error_desc(CUE_SUCCESS)));

  CU_set_error(CUE_NOTEST);
  TEST(!strcmp(CU_get_error_msg(), get_error_desc(CUE_NOTEST)));

  CU_set_error(CUE_NOMEMORY);
  TEST(!strcmp(CU_get_error_msg(), get_error_desc(CUE_NOMEMORY)));
  TEST(strcmp(CU_get_error_msg(), get_error_desc(CUE_SCLEAN_FAILED)));

  TEST(!strcmp(get_error_desc(100), "Undefined Error"));

  /* CU_set_error_action() & CU_get_error_action() */
  CU_set_error_action(CUEA_FAIL);
  TEST(CU_get_error_action() != CUEA_IGNORE);
  TEST(CU_get_error_action() == CUEA_FAIL);
  TEST(CU_get_error_action() != CUEA_ABORT);

  CU_set_error_action(CUEA_ABORT);
  TEST(CU_get_error_action() != CUEA_IGNORE);
  TEST(CU_get_error_action() != CUEA_FAIL);
  TEST(CU_get_error_action() == CUEA_ABORT);

  /* reset  values */
  CU_set_error(old_err);
  CU_set_error_action(old_action);

  test_cunit_end_tests();
}

#endif    /* CUNIT_BUILD_TESTS */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久电影网站中文字幕| 一区二区三区中文字幕电影| 在线视频你懂得一区二区三区| 天天综合天天做天天综合| 香蕉影视欧美成人| 奇米色777欧美一区二区| 亚洲国产日韩在线一区模特| 亚洲精品国产精华液| 一区二区三区中文字幕| 一区二区三区.www| 午夜精品久久久久影视| 日韩国产一区二| 九九**精品视频免费播放| 久久精品国产一区二区三| 国产一区二区三区久久久| 国产成人精品三级麻豆| 99精品欧美一区二区三区综合在线| 成人午夜又粗又硬又大| 91蜜桃视频在线| 欧美片网站yy| 国产日产欧美一区二区视频| 亚洲欧美日韩一区| 日日夜夜一区二区| 国产精品18久久久| 欧美午夜精品一区二区三区| 91精品国产91久久综合桃花| 2020国产精品| 亚洲成人先锋电影| 国产资源在线一区| 99久久精品国产一区| 3d动漫精品啪啪一区二区竹菊 | 国产精品麻豆99久久久久久| 中文字幕不卡的av| 五月天亚洲精品| 懂色av一区二区夜夜嗨| 欧美三级三级三级爽爽爽| 精品久久久久久久久久久院品网| 成人欧美一区二区三区1314| 日韩成人一区二区| 成人免费看视频| 欧美一区二区三区四区久久 | 亚洲午夜精品网| 韩国精品免费视频| 欧美丝袜第三区| 亚洲欧美综合色| 老司机免费视频一区二区| 91年精品国产| 国产性色一区二区| 亚洲电影你懂得| 91捆绑美女网站| 日本一区二区成人在线| 美日韩一区二区三区| 91福利在线观看| 国产精品你懂的在线| 国产乱淫av一区二区三区| 欧美高清你懂得| 亚洲一二三专区| 91网站在线观看视频| 国产视频一区二区三区在线观看| 香蕉加勒比综合久久| 日本道精品一区二区三区| 亚洲国产成人在线| 国产成人免费视频一区| 26uuu久久综合| 九一久久久久久| 欧美电视剧免费全集观看| 亚洲一区二区精品久久av| av在线不卡免费看| 欧美激情一区二区三区不卡| 国产成人a级片| 国产亚洲综合在线| 国产一区二区伦理片| 日韩欧美一级精品久久| 日本不卡一区二区三区| 在线播放中文一区| 婷婷久久综合九色综合绿巨人| 欧美视频在线一区| 日韩国产在线观看| 日韩免费福利电影在线观看| 久久精品国产77777蜜臀| 日韩精品一区二区在线| 精品一区二区精品| 日本一区二区三区电影| 99免费精品视频| 亚洲免费在线看| 欧美视频三区在线播放| 美日韩一级片在线观看| 久久久久久久电影| 成人看片黄a免费看在线| 亚洲乱码中文字幕| 正在播放亚洲一区| 黄页网站大全一区二区| 欧美国产精品一区| 久久女同精品一区二区| 欧美日韩精品一区二区| jiyouzz国产精品久久| 色悠久久久久综合欧美99| 久久精品视频一区| 国产精品私房写真福利视频| 亚洲欧洲成人av每日更新| 亚洲一区二区欧美日韩| 成人a免费在线看| 欧美体内she精视频| 51久久夜色精品国产麻豆| 色婷婷亚洲婷婷| 日韩一区二区三区电影在线观看| 欧美激情在线免费观看| 亚洲最大成人综合| 久久成人免费电影| 日韩欧美你懂的| 精品一区二区三区久久久| 日韩色在线观看| 国产一区欧美日韩| 国产亚洲自拍一区| 日本韩国一区二区三区视频| 亚洲午夜激情网站| 欧美精品一区二区久久婷婷| 国产美女av一区二区三区| 国产亚洲一区二区三区| 99久久er热在这里只有精品66| 亚洲精品午夜久久久| 欧美日韩一区 二区 三区 久久精品| 亚洲国产成人porn| 日韩精品一区二区三区蜜臀| 韩日av一区二区| 亚洲最新视频在线观看| 26uuu另类欧美亚洲曰本| 成人午夜视频网站| 免费看日韩精品| 日本一区二区三区四区| 免费精品99久久国产综合精品| 欧美日韩精品综合在线| 激情av综合网| 日一区二区三区| 精品久久久久久久久久久院品网| 99精品欧美一区二区三区综合在线| 五月激情综合网| 亚洲主播在线观看| 97久久超碰国产精品电影| 日产精品久久久久久久性色| 国产欧美日本一区视频| 欧美美女一区二区三区| 91在线你懂得| gogogo免费视频观看亚洲一| 国产成人在线网站| 午夜激情一区二区| 日韩一区二区影院| 欧美浪妇xxxx高跟鞋交| 欧美日韩免费不卡视频一区二区三区| 91网站最新地址| 欧美日韩夫妻久久| 日韩一区二区影院| 国产精品天天摸av网| 国产精品青草久久| 久久av资源网| 精品在线一区二区三区| 国产自产2019最新不卡| 粉嫩一区二区三区性色av| 精品一区二区三区在线观看| 久久久久久久一区| 国产喷白浆一区二区三区| 亚洲一区在线观看视频| 久久国产精品色婷婷| 91免费版在线看| 欧美一级高清大全免费观看| 国产亚洲精品aa午夜观看| 亚洲欧美一区二区久久| 国产剧情一区在线| 51午夜精品国产| 99久久精品国产一区| 欧美国产日本韩| 一区二区三区在线高清| 久久精品国产久精国产爱| 欧美性欧美巨大黑白大战| 久久精品视频免费| 国产麻豆视频精品| 欧美一区日韩一区| 中文字幕一区二区三区精华液 | 91丝袜呻吟高潮美腿白嫩在线观看| 欧美精品乱码久久久久久| 欧美色手机在线观看| 日韩欧美中文字幕制服| 亚洲图片自拍偷拍| 91免费视频观看| jiyouzz国产精品久久| 韩国成人在线视频| 91视频观看视频| 久久久青草青青国产亚洲免观| 亚洲在线视频网站| 成人一区二区三区视频在线观看| 国产欧美精品一区二区色综合| 国产成人亚洲综合色影视| 欧美日韩激情一区二区| 国产中文一区二区三区| 亚洲精品免费在线| 综合欧美一区二区三区| 国产亚洲欧美日韩日本| 亚洲精品在线电影| 欧美一级在线免费| 日韩视频不卡中文|