This commit is contained in:
biosvos
2026-08-07 17:38:18 +09:00
commit 873193a243
9613 changed files with 2755992 additions and 0 deletions
@@ -0,0 +1,86 @@
/***************************************************************************
LoggerTest.cpp
-----------------------------------------
begin : 2011/10/27
copyright : (C) 2005 SolutionBox Inc.
author : Service 1 Team
email : svc1@solbox.com
version : 1.0
CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
Redistribution and use in source and binary forms, with or with out
modification, are not permitted in outside of SolutionBox Inc.
***************************************************************************/
#include "LoggerTest.h"
#include "Logger.h"
#include <iostream>
CPPUNIT_TEST_SUITE_REGISTRATION( CLoggerTest );
using namespace std;
void CLoggerTest::TestLoggerInit()
{
CPPUNIT_ASSERT( CLogger::Init( "test_util", "/user/service/logs", LDEV1 ) == true );
CLogger::Exit();
}
void CLoggerTest::TestLogging()
{
FUNC_BEGIN();
CPPUNIT_ASSERT( CLogger::Init( "test_util", "/user/service/logs", LDEV1 ) == true );
LOG( LEMR, "log level emergency" );
LOG( LALT, "log level alert" );
LOG( LCRT, "log level critical" );
LOG( LERR, "log level error" );
LOG( LWAR, "log level warning" );
LOG( LNOT, "log level notice" );
LOG( LINF, "log level info" );
LOG( LDBG, "log level debug" );
LOG( LDEV, "log level dev" );
LOG( LDEV1, "log level dev1" );
_LOG_( LEMR, "-------------------------------------------------------------" );
_LOG( LEMR, "log level emergency" );
_LOG( LALT, "log level alert" );
_LOG( LCRT, "log level critical" );
_LOG( LERR, "log level error" );
_LOG( LWAR, "log level warning" );
_LOG( LNOT, "log level notice" );
_LOG( LINF, "log level info" );
_LOG( LDBG, "log level debug" );
_LOG( LDEV, "log level dev" );
_LOG( LDEV1, "log level dev1" );
_LOG_( LEMR, "-------------------------------------------------------------" );
_LOG_( LEMR, "log level emergency" );
_LOG_( LALT, "log level alert" );
_LOG_( LCRT, "log level critical" );
_LOG_( LERR, "log level error" );
_LOG_( LWAR, "log level warning" );
_LOG_( LNOT, "log level notice" );
_LOG_( LINF, "log level info" );
_LOG_( LDBG, "log level debug" );
_LOG_( LDEV, "log level dev" );
_LOG_( LDEV1, "log level dev1" );
_LOG_( LEMR, "-------------------------------------------------------------" );
unsigned char hexData[48] =
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F
};
_LOG_HEX_( LDBG, hexData, 48 );
CLogger::Exit();
FUNC_END();
}
@@ -0,0 +1,50 @@
/***************************************************************************
LoggerTest.h
-----------------------------------------
begin : 2011/10/27
copyright : (C) 2005 SolutionBox Inc.
author : Service 1 Team
email : svc1@solbox.com
version : 1.0
CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
Redistribution and use in source and binary forms, with or with out
modification, are not permitted in outside of SolutionBox Inc.
***************************************************************************/
#ifndef __LOGGERTEST_H__
#define __LOGGERTEST_H__
#include "UnitTestIncl.h"
class CLoggerTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( CLoggerTest );
CPPUNIT_TEST( TestLoggerInit );
CPPUNIT_TEST( TestLogging );
CPPUNIT_TEST_SUITE_END();
// Attributes
private:
protected:
public:
// Operations
private:
void TestLoggerInit();
void TestLogging();
protected:
public:
CLoggerTest() {};
virtual ~CLoggerTest() {};
void setUp() {};
void tearDown() {};
};
#endif // __LOGGERTEST_H__
+88
View File
@@ -0,0 +1,88 @@
#****************************************************************************
# Makefile for rc_rmcd
# -----------------------------------------
#
# begin : 2010/03/09
# copyright : (C) 2005 SolutionBox Inc.
# author : Service 1 Team
# email : svc1@solbox.com
# version : 1.0
#
# CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
# Redistribution and use in source and binary forms, with or with out
# modification, are not permitted in outside of SolutionBox Inc.
#*****************************************************************************
# Program info
PROG_NAME = test_util
REVISION = 333
PROG_VERSION = 3.0.0.$(REVISION)_T-`date +%Y%m%d%H%M%S`
# Compiler info
CC = /usr/bin/g++
CFLAGS = -Wall -O3 -g -Wimplicit -Wreturn-type -Wunused -Wuninitialized\
-Wparentheses -Wshadow -Wpointer-arith -Woverloaded-virtual\
-D_REENTRANT
LFLAGS =
# DEBUG or RELEASE Mode select
#DFLAGS = -D_DEBUG_ -DPROG_NAME=\"$(PROG_NAME)\" -DPROG_VERSION=\"$(PROG_VERSION)\"
DFLAGS = -DPROG_NAME=\"$(PROG_NAME)\" -DPROG_VERSION=\"$(PROG_VERSION)\"
# Application Enviroment
APP = $(PROG_NAME)
DIR_INCLUDE = -I. -I.. \
-I/usr/local/include \
-I/user/db/pgsql/include \
DIR_LIB = -L. \
-L../lib \
-L/usr/local/lib
LIBS = -lcppunit \
-lcrypt \
-lpthread
OBJ = main.o UnitTestRunner.o \
LoggerTest.o ../Logger.o \
############################
#ROOT_DIR = /root/src_svn/work/mytest/cmctl/src
#DIRS = $(ROOT_DIR)/Framework $(ROOT_DIR)/DataObject $(ROOT_DIR)/Database $(ROOT_DIR)/Cmctl
all: MAKE_LIBS $(APP)
sync
%.o: %.cpp
$(CC) $(CFLAGS) -o $@ -c $^ $(DFLAGS) $(DIR_INCLUDE)
$(PROG_NAME): $(OBJ)
$(CC) $(LFLAGS) -o $@ $^ $(OBJS) $(DFLAGS) $(DIR_LIB) $(LIBS)
clean:
-rm -f *.o core *.out *.log
-rm -f $(APP)
sync
MAKE_LIBS:
@for dir in $(DIRS); do \
gmake -C $$dir || exit $?; \
done
-rm -f $(APP)
# cd ../Framework; gmake; cp ../Framework/*.a ../../lib
# cd ../DataObject; gmake; cp ../DataObject/*.a ../../lib
# cd ../Database; gmake; cp ../Database/*.a ../../lib
# cd ../Cmctl; gmake; cp ../Cmctl/*.a ../../lib
# End of Makefile
@@ -0,0 +1,21 @@
/***************************************************************************
UnitTestIncl.h
-----------------------------------------
begin : 2011/10/27
copyright : (C) 2005 SolutionBox Inc.
author : Service 1 Team
email : svc1@solbox.com
version : 1.0
CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
Redistribution and use in source and binary forms, with or with out
modification, are not permitted in outside of SolutionBox Inc.
***************************************************************************/
#ifndef __UNITTESTINCL_h__
#define __UNITTESTINCL_h__
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#endif // __UNITTESTINCL_h__
@@ -0,0 +1,20 @@
#include "UnitTestRunner.h"
CUnitTestRunner::CUnitTestRunner()
{
}
CUnitTestRunner::~CUnitTestRunner()
{
}
void
CUnitTestRunner::Run()
{
CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
CppUnit::TextUi::TestRunner runner;
runner.addTest( registry.makeTest() );
runner.run();
}
@@ -0,0 +1,39 @@
/***************************************************************************
UnitTestRunner.h
-----------------------------------------
begin : 2011/10/27
copyright : (C) 2005 SolutionBox Inc.
author : Service 1 Team
email : svc1@solbox.com
version : 1.0
CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
Redistribution and use in source and binary forms, with or with out
modification, are not permitted in outside of SolutionBox Inc.
***************************************************************************/
#ifndef __UNITTESTRUNNER_H__
#define __UNITTESTRUNNER_H__
#include "UnitTestIncl.h"
class CUnitTestRunner
{
// Attributes
private:
protected:
public:
// Operations
private:
CUnitTestRunner();
~CUnitTestRunner();
protected:
public:
static void Run();
};
#endif // __UNITTESTRUNNER_H__
@@ -0,0 +1,8 @@
#include "UnitTestRunner.h"
int main( int argc, char** argv )
{
CUnitTestRunner::Run();
return 0;
}