Commit 58a586f1 authored by jds2's avatar jds2

Corrected minor bugs in sources from recent changes on Linux.


git-svn-id: http://svn.code.sf.net/p/cunit/code/trunk@100 f00e6729-6848-4c17-8bfb-678c97c00071
parent 0d041aab
......@@ -83,7 +83,7 @@
#define CU_UNREFERENCED_PARAMETER(x) (void)x
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__WIN32__)
#ifdef WIN32
# ifdef CU_DLL
# ifdef CU_BUILD_DLL
# define CU_EXPORT __declspec(dllexport)
......@@ -93,9 +93,6 @@
# else
# define CU_EXPORT
# endif
# ifdef _MSC_VER
# define snprintf _snprintf
# endif
#else
# define CU_EXPORT
#endif
......
/*
* CUnit - A Unit testing framework library for C.
* Copyright (C) 2001 Anil Kumar
* Copyright (C) 2004,2005,2006 Anil Kumar, Jerry St.Clair
* Copyright (C) 2001 Anil Kumar
* Copyright (C) 2004-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
......@@ -83,7 +83,7 @@
#define CU_UNREFERENCED_PARAMETER(x) (void)x
#endif
#ifdef WIN32
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__WIN32__)
# ifdef CU_DLL
# ifdef CU_BUILD_DLL
# define CU_EXPORT __declspec(dllexport)
......@@ -93,6 +93,9 @@
# else
# define CU_EXPORT
# endif
# ifdef _MSC_VER
# define snprintf _snprintf
# endif
#else
# define CU_EXPORT
#endif
......
......@@ -53,10 +53,6 @@
#include <ctype.h>
#include <assert.h>
#include <string.h>
#if defined(_MSC_VER)
#include <conio.h>
#define getch _getch
#endif
#include "CUnit.h"
#include "TestDB.h"
......@@ -147,13 +143,16 @@ static void console_registry_level_run(CU_pTestRegistry pRegistry)
int chChoice;
CU_pSuite pSuite = NULL;
STATUS eStatus = CONTINUE;
char szTemp[256];
while (CONTINUE == eStatus)
{
fprintf(stdout, "\n***************** CUNIT CONSOLE - MAIN MENU ******************************"
"\n(R)un (S)elect (L)ist (A)ctivate (F)ailures (O)ptions (H)elp (Q)uit\n");
chChoice = getch();
"\n(R)un (S)elect (L)ist (A)ctivate (F)ailures (O)ptions (H)elp (Q)uit"
"\nEnter command: ");
chChoice = getchar();
fgets(szTemp, 256, stdin); /* flush any chars out of the read buffer */
switch (tolower(chChoice)) {
case 'r':
console_run_all_tests(pRegistry);
......@@ -227,14 +226,17 @@ static STATUS console_suite_level_run(CU_pSuite pSuite)
int chChoice;
CU_pTest pTest = NULL;
STATUS eStatus = CONTINUE;
char szTemp[256];
assert(NULL != pSuite);
while (CONTINUE == eStatus) {
fprintf(stdout, "\n***************** CUNIT CONSOLE - SUITE MENU ***************************"
"\n(R)un (S)elect (L)ist (A)ctivate (F)ailures (U)p (O)ptions (H)elp (Q)uit\n");
chChoice = getch();
"\n(R)un (S)elect (L)ist (A)ctivate (F)ailures (U)p (O)ptions (H)elp (Q)uit"
"\nEnter command: ");
chChoice = getchar();
fgets(szTemp, 256, stdin); /* flush any chars out of the read buffer */
switch (tolower(chChoice)) {
case 'r':
......@@ -312,6 +314,7 @@ static STATUS console_set_options_run(void)
{
int chChoice;
STATUS eStatus = CONTINUE;
char szTemp[256];
while (CONTINUE == eStatus) {
......@@ -320,7 +323,8 @@ static STATUS console_set_options_run(void)
"\n********************************************************************"
"\nEnter number of option to change (any other key to exit) :",
(CU_FALSE != CU_get_fail_on_inactive()) ? "YES" : "NO");
chChoice = getch();
chChoice = getchar();
fgets(szTemp, 256, stdin); /* flush any chars out of the read buffer */
switch (tolower(chChoice)) {
case '1':
......
This diff is collapsed.
......@@ -154,21 +154,6 @@ CU_pSuite CU_add_suite(const char* strName, CU_InitializeFunc pInit, CU_CleanupF
else if (NULL == strName) {
error = CUE_NO_SUITENAME;
}
// TODO: decide on implementation
/* old implementation
else if (CU_TRUE == suite_exists(f_pTestRegistry, strName)) {
error = CUE_DUP_SUITE;
}
else {
pRetValue = create_suite(strName, pInit, pClean);
if (NULL == pRetValue) {
error = CUE_NOMEMORY;
}
else {
insert_suite(f_pTestRegistry, pRetValue);
}
}
*/
else {
pRetValue = create_suite(strName, pInit, pClean);
if (NULL == pRetValue) {
......@@ -370,22 +355,6 @@ CU_pTest CU_add_test(CU_pSuite pSuite, const char* strName, CU_TestFunc pTestFun
else if(NULL == pTestFunc) {
error = CUE_NOTEST;
}
// TODO: decide on implementation
/* old implementation
else if (CU_TRUE == test_exists(pSuite, strName)) {
error = CUE_DUP_TEST;
}
else {
pRetValue = create_test(strName, pTestFunc);
if (NULL == pRetValue) {
error = CUE_NOMEMORY;
}
else {
f_pTestRegistry->uiNumberOfTests++;
insert_test(pSuite, pRetValue);
}
}
*/
else {
pRetValue = create_test(strName, pTestFunc);
if (NULL == pRetValue) {
......
......@@ -19,7 +19,7 @@
*/
/*
* Implementation of Console Test Interface.
* Implementation of Test Run Interface.
*
* Aug 2001 Initial implementaion (AK)
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment