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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? basic.c

?? 單元測試 單元測試 單元測試 單元測試 單元測試 單元測試 單元測試 單元測試 單元測試 單元測試 單元測試
?? C
字號:
/*
 *  CUnit - A Unit testing framework library for C.
 *  Copyright (C) 2004, 2005  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
 */

/*
 *  Implementation for basic test runner interface.
 *
 *  Created By  : Jerry St.Clair  (11-Aug-2004)
 *  Comment     : Initial implementation of basic test runner interface
 *  EMail       : jds2@users.sourceforge.net
 *
 *  Modified    : 8-Jan-2005 (JDS)
 *  Comment     : Fixed reporting bug (bug report cunit-Bugs-1093861).
 *  Email       : jds2@users.sourceforge.net
 *
 *  Modified    : 30-Apr-2005 (JDS)
 *  Comment     : Added notification of suite cleanup failure.
 *  Email       : jds2@users.sourceforge.net
 */

/** @file
 * Basic interface with output to stdout.
 */
/** @addtogroup Basic
 * @{
 */

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <string.h>

#include "CUnit.h"
#include "TestDB.h"
#include "Util.h"
#include "TestRun.h"
#include "Basic.h"

/** Pointer to the currently running suite. */
static CU_pSuite f_pRunningSuite = NULL;
/** Current run mode. */
static CU_BasicRunMode f_run_mode = CU_BRM_NORMAL;

/* Forward declaration of module functions */
static CU_ErrorCode basic_initialize(void);
static CU_ErrorCode basic_run_all_tests(CU_pTestRegistry pRegistry);
static CU_ErrorCode basic_run_suite(CU_pSuite pSuite);
static CU_ErrorCode basic_run_single_test(CU_pSuite pSuite, CU_pTest pTest);

static void basic_test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSuite);
static void basic_test_complete_message_handler(const CU_pTest pTest, const CU_pSuite pSuite, const CU_pFailureRecord pFailureList);
static void basic_all_tests_complete_message_handler(const CU_pFailureRecord pFailure);
static void basic_suite_init_failure_message_handler(const CU_pSuite pSuite);
static void basic_suite_cleanup_failure_message_handler(const CU_pSuite pSuite);

/*------------------------------------------------------------------------*/
/** Run all registered CUnit tests using the basic interface.
 *  The default CU_BasicRunMode is used unless it has been
 *  previously changed using CU_basic_set_mode().  The CUnit test
 *  registry must have been initialized before calling this function.
 *  @return A CU_ErrorCode indicating the framework error condition, including
 *          CUE_NOREGISTRY - Registry has not been initialized.
 */
CU_ErrorCode CU_basic_run_tests(void)
{
  CU_ErrorCode error;

  if (NULL == CU_get_registry()) {
    if (CU_BRM_SILENT != f_run_mode)
      fprintf(stderr, "\n\nFATAL ERROR - Test registry is not initialized.\n");
    error = CUE_NOREGISTRY;
  }
  else if (CUE_SUCCESS == (error = basic_initialize()))
    error = basic_run_all_tests(NULL);

  return error;
}

/*------------------------------------------------------------------------*/
/** Run all tests for a specific suite in the basic interface.
 *  If pSuite is NULL, the function returns without taking any
 *  action. The default CU_BasicRunMode is used unless it has
 *  been changed using CU_basic_set_mode().
 *  @param pSuite The CU_Suite to run.
 *  @return A CU_ErrorCode indicating the framework error condition, including
 *          CUE_NOSUITE - pSuite was NULL.
 */
CU_ErrorCode CU_basic_run_suite(CU_pSuite pSuite)
{
  CU_ErrorCode error;

  if (NULL != pSuite)
    error = CUE_NOSUITE;
  else if (CUE_SUCCESS == (error = basic_initialize()))
    error = basic_run_suite(pSuite);

  return error;
}

/*------------------------------------------------------------------------*/
/** Run a single test in a specific suite in the basic interface.
 *  If pSuite or pTest is NULL, the function returns without
 *  taking any action.  The default CU_BasicRunMode is used unless
 *  it has been changed using CU_basic_set_mode.
 *  @param pSuite The CU_Suite holding the CU_Test to run.
 *  @param pTest  The CU_Test to run.
 *  @return A CU_ErrorCode indicating the framework error condition, including
 *          CUE_NOSUITE - pSuite was NULL.
 *          CUE_NOTEST  - pTest was NULL.
 */
CU_ErrorCode CU_basic_run_test(CU_pSuite pSuite, CU_pTest pTest)
{
  CU_ErrorCode error;

  if (NULL != pSuite)
    error = CUE_NOSUITE;
  else if (NULL != pTest)
    error = CUE_NOTEST;
  else if (CUE_SUCCESS == (error = basic_initialize()))
    error = basic_run_single_test(pSuite, pTest);

  return error;
}

/*------------------------------------------------------------------------*/
/** Set the run mode for the basic interface.
 *  @param mode The new CU_BasicRunMode for subsequent test
 *              runs using the basic interface.
 */
void CU_basic_set_mode(CU_BasicRunMode mode)
{
  f_run_mode = mode;
}

/*------------------------------------------------------------------------*/
/** Retrieve the current run mode for the basic interface.
 *  @return The current CU_BasicRunMode setting for test
 *              runs using the basic interface.
 */
CU_BasicRunMode CU_basic_get_mode(void)
{
  return f_run_mode;
}

/*------------------------------------------------------------------------*/
/** Print a summary of run failures to stdout.
 *  This is provided for user convenience upon request, and
 *  does not take into account the current run mode.  The
 *  failures are printed to stdout independent of the most
 *  recent run mode.
 *  @param pFailure List of CU_pFailureRecord's to output.
 */
void CU_basic_show_failures(CU_pFailureRecord pFailure)
{
  int i;

  for (i = 1 ; (NULL != pFailure) ; pFailure = pFailure->pNext, i++) {
    fprintf(stdout, "\n  %d. %s:%u  - %s", i,
        (NULL != pFailure->strFileName) ? pFailure->strFileName : "",
        pFailure->uiLineNumber,
        (NULL != pFailure->strCondition) ? pFailure->strCondition : "");
  }
}

/*------------------------------------------------------------------------*/
/** Perform inialization actions for the basic interface.
 *  This includes setting output to unbuffered, printing a
 *  welcome message, and setting the test run handlers.
 *  @return An error code indicating the framework error condition.
 */
static CU_ErrorCode basic_initialize(void)
{
  /* Unbuffered output so everything reaches the screen */
  setvbuf(stdout, NULL, _IONBF, 0);
  setvbuf(stderr, NULL, _IONBF, 0);

  CU_set_error(CUE_SUCCESS);

  if (CU_BRM_SILENT != f_run_mode)
    fprintf(stdout, "\n\n     CUnit - A Unit testing framework for C - Version " CU_VERSION
                      "\n     http://cunit.sourceforge.net/\n\n");

  CU_set_test_start_handler(basic_test_start_message_handler);
  CU_set_test_complete_handler(basic_test_complete_message_handler);
  CU_set_all_test_complete_handler(basic_all_tests_complete_message_handler);
  CU_set_suite_init_failure_handler(basic_suite_init_failure_message_handler);
  CU_set_suite_cleanup_failure_handler(basic_suite_cleanup_failure_message_handler);

  return CU_get_error();
}

/*------------------------------------------------------------------------*/
/** Run all tests within the basic interface.
 *  If non-NULL, the test registry is changed to the specified
 *  registry before running the tests, and reset to the original
 *  registry when done.  If NULL, the default CUnit test registry
 *  will be used.
 *  @param pRegistry The CU_pTestRegistry containing the tests
 *                   to be run.  If NULL, use the default registry.
 *  @return An error code indicating the error status
 *          during the test run.
 */
static CU_ErrorCode basic_run_all_tests(CU_pTestRegistry pRegistry)
{
  CU_pTestRegistry pOldRegistry = NULL;
  CU_ErrorCode result;

  f_pRunningSuite = NULL;

  if (NULL != pRegistry)
    pOldRegistry = CU_set_registry(pRegistry);
  result = CU_run_all_tests();
  if (NULL != pRegistry)
    CU_set_registry(pOldRegistry);
  return result;
}

/*------------------------------------------------------------------------*/
/** Run a specified suite within the basic interface.
 *  @param pSuite The suite to be run (non-NULL).
 *  @return An error code indicating the error status
 *          during the test run.
 */
static CU_ErrorCode basic_run_suite(CU_pSuite pSuite)
{
  f_pRunningSuite = NULL;
  return CU_run_suite(pSuite);
}

/*------------------------------------------------------------------------*/
/** Run a single test for the specified suite within
 *  the console interface.
 *  @param pSuite The suite containing the test to be run (non-NULL).
 *  @param pTest  The test to be run (non-NULL).
 *  @return An error code indicating the error status
 *          during the test run.
 */
static CU_ErrorCode basic_run_single_test(CU_pSuite pSuite, CU_pTest pTest)
{
  f_pRunningSuite = NULL;
  return CU_run_test(pSuite, pTest);
}

/*------------------------------------------------------------------------*/
/** Handler function called at start of each test.
 *  @param pTest  The test being run.
 *  @param pSuite The suite containing the test.
 */
static void basic_test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSuite)
{
  assert(NULL != pSuite);
  assert(NULL != pTest);

  if (CU_BRM_VERBOSE == f_run_mode) {
    if ((NULL == f_pRunningSuite) || (f_pRunningSuite != pSuite)) {
      fprintf(stdout, "\nSuite: %s", (NULL != pSuite->pName) ? pSuite->pName : "");
      fprintf(stdout, "\n  Test: %s ... ", (NULL != pTest->pName) ? pTest->pName : "");
      f_pRunningSuite = pSuite;
    }
    else {
      fprintf(stdout, "\n  Test: %s ... ", (NULL != pTest->pName) ? pTest->pName : "");
    }
  }
}

/*------------------------------------------------------------------------*/
/** Handler function called at completion of each test.
 *  @param pTest   The test being run.
 *  @param pSuite  The suite containing the test.
 *  @param pFailure Pointer to the 1st failure record for this test.
 */
static void basic_test_complete_message_handler(const CU_pTest pTest, 
                                                const CU_pSuite pSuite, 
                                                const CU_pFailureRecord pFailureList)
{
  CU_pFailureRecord pFailure = pFailureList;
  int i;

  assert(NULL != pSuite);
  assert(NULL != pTest);

  if (NULL == pFailure) {
    if (CU_BRM_VERBOSE == f_run_mode) {
      fprintf(stdout, "passed");
    }
  }
  else {
    switch (f_run_mode) {
      case CU_BRM_VERBOSE:
        fprintf(stdout, "FAILED");
        break;
      case CU_BRM_NORMAL:
        fprintf(stdout, "\nSuite %s, Test %s had failures:", 
                        (NULL != pSuite->pName) ? pSuite->pName : "",
                        (NULL != pTest->pName) ? pTest->pName : "");
        break;
      default:  /* gcc wants all enums covered.  ok. */
        break;
    }
    if (CU_BRM_SILENT != f_run_mode) {
      for (i = 1 ; (NULL != pFailure) ; pFailure = pFailure->pNext, i++) {
        fprintf(stdout, "\n    %d. %s:%u  - %s", i,
            (NULL != pFailure->strFileName) ? pFailure->strFileName : "",
            pFailure->uiLineNumber,
            (NULL != pFailure->strCondition) ? pFailure->strCondition : "");
      }
    }
  }
}

/*------------------------------------------------------------------------*/
/** Handler function called at completion of all tests in a suite.
 *  @param pFailure Pointer to the test failure record list.
 */
static void basic_all_tests_complete_message_handler(const CU_pFailureRecord pFailure)
{
  CU_pRunSummary pRunSummary = CU_get_run_summary();
  CU_pTestRegistry pRegistry = CU_get_registry();

  CU_UNREFERENCED_PARAMETER(pFailure); /* not used in basic interface */

  assert(NULL != pRunSummary);
  assert(NULL != pRegistry);

  if (CU_BRM_SILENT != f_run_mode)
    fprintf(stdout,"\n\n--Run Summary: Type      Total     Ran  Passed  Failed"
                     "\n               suites %8u%8u     n/a%8u"
                     "\n               tests  %8u%8u%8u%8u"
                     "\n               asserts%8u%8u%8u%8u\n",
                    pRegistry->uiNumberOfSuites,
                    pRunSummary->nSuitesRun,
                    pRunSummary->nSuitesFailed,
                    pRegistry->uiNumberOfTests,
                    pRunSummary->nTestsRun,
                    pRunSummary->nTestsRun - pRunSummary->nTestsFailed,
                    pRunSummary->nTestsFailed,
                    pRunSummary->nAsserts,
                    pRunSummary->nAsserts,
                    pRunSummary->nAsserts - pRunSummary->nAssertsFailed,
                    pRunSummary->nAssertsFailed);
}

/*------------------------------------------------------------------------*/
/** Handler function called when suite initialization fails.
 *  @param pSuite The suite for which initialization failed.
 */
static void basic_suite_init_failure_message_handler(const CU_pSuite pSuite)
{
  assert(NULL != pSuite);

  if (CU_BRM_SILENT != f_run_mode)
    fprintf(stdout,
            "\nWARNING - Suite initialization failed for %s.",
            (NULL != pSuite->pName) ? pSuite->pName : "");
}

/*------------------------------------------------------------------------*/
/** Handler function called when suite cleanup fails.
 *  @param pSuite The suite for which cleanup failed.
 */
static void basic_suite_cleanup_failure_message_handler(const CU_pSuite pSuite)
{
  assert(NULL != pSuite);

  if (CU_BRM_SILENT != f_run_mode)
    fprintf(stdout,
            "\nWARNING - Suite cleanup failed for %s.",
            (NULL != pSuite->pName) ? pSuite->pName : "");
}

/** @} */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
热久久免费视频| 日本欧美大码aⅴ在线播放| 777xxx欧美| a级高清视频欧美日韩| 麻豆久久一区二区| 久久精品免视看| 欧美高清hd18日本| 91网上在线视频| 国内精品第一页| 秋霞午夜鲁丝一区二区老狼| 中文字幕色av一区二区三区| 精品1区2区在线观看| 精品污污网站免费看| 成人app软件下载大全免费| 美女mm1313爽爽久久久蜜臀| 一区二区三区四区不卡在线| 久久精品人人做人人爽人人| 日韩一区二区在线观看| 99久久综合狠狠综合久久| 国模套图日韩精品一区二区 | 欧美电视剧在线看免费| 波多野结衣中文一区| 国产自产v一区二区三区c| 日本成人在线电影网| 18成人在线视频| 国产精品欧美一级免费| 国产亚洲视频系列| 精品福利二区三区| 欧美v日韩v国产v| 欧美一级理论性理论a| 欧美日韩高清一区二区三区| 色婷婷综合久久久中文一区二区| 99久久久无码国产精品| 波多野结衣欧美| 成人开心网精品视频| 国产精品亚洲专一区二区三区| 精品亚洲成a人| 国产伦精品一区二区三区在线观看 | 不卡视频在线看| 高清久久久久久| 成人黄色电影在线 | 91精品蜜臀在线一区尤物| 欧美丰满嫩嫩电影| 欧美一级片在线| 日韩一级视频免费观看在线| 3d成人动漫网站| 日韩欧美国产电影| 久久亚洲春色中文字幕久久久| 26uuu精品一区二区| 久久久久久久久岛国免费| 国产亚洲精品中文字幕| 亚洲欧洲日韩综合一区二区| 亚洲激情男女视频| 亚洲成人一区二区| 青青草97国产精品免费观看无弹窗版| 日韩 欧美一区二区三区| 久久精品国产久精国产爱| 国产精品自产自拍| 91免费精品国自产拍在线不卡| 色婷婷香蕉在线一区二区| 欧美午夜在线观看| 日韩精品专区在线| 国产精品不卡一区| 一区二区三区精品在线| 午夜成人在线视频| 久久91精品国产91久久小草 | 欧美图区在线视频| 精品三级av在线| 国产精品福利一区二区三区| 国产精品看片你懂得| 亚洲欧洲国产日韩| 日韩和欧美的一区| 国产成人免费视频一区| 色婷婷精品久久二区二区蜜臀av| 欧美裸体bbwbbwbbw| 制服.丝袜.亚洲.中文.综合| 日本vs亚洲vs韩国一区三区二区 | 国产色综合一区| 亚洲免费伊人电影| 日韩成人dvd| av资源网一区| 日韩免费电影一区| 亚洲婷婷在线视频| 奇米色一区二区| 91丨九色丨蝌蚪丨老版| 欧美一区二区三区在线电影 | 免费在线观看一区| av在线不卡免费看| 日韩午夜av一区| 中文字幕欧美一| 精品在线免费视频| 色婷婷综合久久久中文一区二区| 精品欧美一区二区三区精品久久 | 日韩二区三区在线观看| eeuss鲁片一区二区三区| 91超碰这里只有精品国产| 国产片一区二区| 日本美女一区二区| 91丨porny丨在线| 精品粉嫩超白一线天av| 亚洲成人中文在线| 99久久精品免费| 精品精品欲导航| 五月天视频一区| av亚洲精华国产精华| 精品免费日韩av| 亚洲成人动漫精品| 91麻豆自制传媒国产之光| 国产性做久久久久久| 久久国产精品99精品国产| 91黄色激情网站| 国产精品第四页| 国产乱色国产精品免费视频| 777奇米四色成人影色区| 樱桃视频在线观看一区| 99精品国产91久久久久久| 久久精品人人做人人综合| 另类综合日韩欧美亚洲| 欧美一级专区免费大片| 亚洲高清免费在线| 欧美三级乱人伦电影| 亚洲精品国产无套在线观| 成人网在线播放| 国产色产综合产在线视频| 国产麻豆一精品一av一免费| 亚洲精品在线电影| 久久99精品久久久久久动态图| 欧美一区二区在线看| 日韩av一级电影| 欧美一级专区免费大片| 免费精品99久久国产综合精品| 91精品黄色片免费大全| 日韩精品亚洲专区| 欧美一区二区美女| 另类小说综合欧美亚洲| 欧美tk—视频vk| 国产麻豆视频一区二区| 国产欧美一区二区三区在线看蜜臀 | 久久精品国产精品亚洲综合| 欧美不卡123| 狠狠色狠狠色合久久伊人| 久久久综合激的五月天| 国产91在线观看| 亚洲欧洲精品天堂一级| 在线亚洲免费视频| 亚洲一区二区欧美| 欧美久久高跟鞋激| 一区二区久久久| 一本色道久久综合亚洲精品按摩| 欧美tickling网站挠脚心| 中文字幕亚洲电影| 日本高清视频一区二区| 亚洲免费电影在线| 91福利在线免费观看| 亚洲福利视频三区| 欧美一级午夜免费电影| 国产精品一二三区在线| 国产精品水嫩水嫩| 91污片在线观看| 天堂午夜影视日韩欧美一区二区| 91精品国产高清一区二区三区| 美女精品一区二区| 欧美激情一区二区三区蜜桃视频| 色综合久久中文综合久久牛| 午夜亚洲国产au精品一区二区| 日韩一级大片在线观看| 国产91对白在线观看九色| 亚洲乱码国产乱码精品精98午夜 | 欧美一级理论片| 国产成人av影院| 一区二区三区四区高清精品免费观看| 欧美精品久久99| 成人一区二区视频| 亚洲午夜免费电影| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 亚洲综合在线五月| 欧美变态凌虐bdsm| 91麻豆免费观看| 国模冰冰炮一区二区| 一区二区三区电影在线播| 精品粉嫩超白一线天av| 欧亚一区二区三区| 激情综合色综合久久| 亚洲小说春色综合另类电影| 久久综合久久综合亚洲| 日本高清不卡视频| 国产一区二区在线观看免费| 亚洲精品国产视频| 久久精品一区二区三区四区| 欧美午夜精品一区二区三区| 国产精品一二三区在线| 午夜视频一区二区| 日韩久久一区二区| 精品久久久久一区二区国产| 日本高清不卡aⅴ免费网站| 国产在线播放一区| 日精品一区二区三区| 国产精品高潮呻吟| 日韩精品中文字幕一区二区三区| 91久久精品日日躁夜夜躁欧美|