Skip to content

Commit

Permalink
update r677
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Aug 10, 2014
1 parent 18ffd31 commit b36b4f7
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 15 deletions.
2 changes: 1 addition & 1 deletion doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = iutest
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.9.99.21
PROJECT_NUMBER = 1.9.99.22

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion doc/cover.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<div class="contents">
<h1>IUTEST</h1>
<div class="text_block">
Iris Unit Test Framework : 2014 / 05 / 29<br />
Iris Unit Test Framework : 2014 / 08 / 09<br />
<br />
</div>
<h2>はじめに</h2>
Expand Down
1 change: 1 addition & 0 deletions doc/primer.html
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@
IUTEST_ASSERT_TRUE(true);
}
}</pre>
また、--iutest_root_package_name コマンドラインオプションでルートパッケージ名を設定できます。<br />
<br />
</li>

Expand Down
32 changes: 32 additions & 0 deletions include/impl/iutest_default_printer.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,22 @@ IUTEST_IPP_INLINE void DefalutResultPrintListener::OnTestIterationEnd(const Unit
{
detail::iuConsole::color_output(detail::iuConsole::yellow, "[ DISABLED ] ");
detail::iuConsole::output("%d tests.\n", count );
if( TestFlag::IsEnableFlag(TestFlag::VERBOSE) )
{
for( int i=0, count=test.total_test_case_count(); i < count; ++i )
{
const TestCase* testcase = test.GetTestCase(i);
for( int j=0, info_count=testcase->total_test_count(); j < info_count; ++j )
{
const TestInfo* testinfo = testcase->GetTestInfo(j);
if( testinfo->is_disabled_test() )
{
detail::iuConsole::color_output(detail::iuConsole::yellow, "[ DISABLED ] ");
detail::iuConsole::output("%s.%s\n", testinfo->test_case_name(), testinfo->name());
}
}
}
}
}
}
{
Expand All @@ -170,6 +186,22 @@ IUTEST_IPP_INLINE void DefalutResultPrintListener::OnTestIterationEnd(const Unit
{
detail::iuConsole::color_output(detail::iuConsole::yellow, "[ SKIPPED ] ");
detail::iuConsole::output("%d tests.\n", count );
if( TestFlag::IsEnableFlag(TestFlag::VERBOSE) )
{
for( int i=0, count=test.total_test_case_count(); i < count; ++i )
{
const TestCase* testcase = test.GetTestCase(i);
for( int j=0, info_count=testcase->total_test_count(); j < info_count; ++j )
{
const TestInfo* testinfo = testcase->GetTestInfo(j);
if( testinfo->is_skipped() )
{
detail::iuConsole::color_output(detail::iuConsole::yellow, "[ SKIPPED ] ");
detail::iuConsole::output("%s.%s\n", testinfo->test_case_name(), testinfo->name());
}
}
}
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions include/impl/iutest_env.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ IUTEST_IPP_INLINE bool TestEnv::ParseCommandLineElemA(const char* str)
{
TestFlag::SetFlag(TestFlag::SHOW_SPEC);
}
else if( detail::IsStringEqual(str, "verbose") )
{
TestFlag::SetFlag(TestFlag::VERBOSE);
}
else
{
find = false;
Expand Down
23 changes: 12 additions & 11 deletions include/internal/iutest_option_message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ inline void iuOptionMessage::ShowHelp(void)
"--------------------------------------------------\n"
"Command Line Options\n"
"\n"
" --help, -h : generate help message.\n"
" --iutest_output=xml[:path] : path of xml report.\n"
" --iutest_list_tests : list up tests.\n"
" --iutest_list_tests_with_where : list up tests with where.\n"
" --iutest_color=<yes|no|auto|ansi>: console color enable.\n"
" --help, -h : Generate help message.\n"
" --iutest_output=xml[:path] : Path of xml report.\n"
" --iutest_list_tests : List up tests.\n"
" --iutest_list_tests_with_where : List up tests with where.\n"
" --iutest_color=<yes|no|auto|ansi>: Console color enable.\n"
" --iutest_filter=<filter> : Select the test run.\n"
" --iutest_shuffle : do shuffle test.\n"
" --iutest_random_seed=<seed> : set random seed.\n"
" --iutest_also_run_disabled_tests : run disabled tests.\n"
" --iutest_shuffle : Do shuffle test.\n"
" --iutest_random_seed=<seed> : Set random seed.\n"
" --iutest_also_run_disabled_tests : Run disabled tests.\n"
" --iutest_break_on_failure[=0|1] : When that failed to break.\n"
" --iutest_throw_on_failure[=0|1] : When that failed to throw.\n"
" --iutest_catch_exceptions=<0|1> : catch exceptions enable.\n"
" --iutest_catch_exceptions=<0|1> : Catch exceptions enable.\n"
" --iutest_print_time=<0|1> : Setting the display of elapsed time.\n"
" --iutest_repeat=<count> : Set the number of repetitions\n"
" of the test.\n"
Expand All @@ -76,8 +76,9 @@ inline void iuOptionMessage::ShowHelp(void)
#endif
" --iutest_file_location=<auto|vs|gcc>\n"
" : Format file location messages.\n"
" --feature : show iutest feature.\n"
" --version, -v : show iutest version.\n"
" --verbose : Verbose option.\n"
" --feature : Show iutest feature.\n"
" --version, -v : Show iutest version.\n"
"\n"
"--------------------------------------------------\n"
"License\n"
Expand Down
4 changes: 4 additions & 0 deletions include/iutest_env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ class Environment
virtual ~Environment(void) {}
virtual void SetUp(void) {} //!< 事前処理
virtual void TearDown(void) {} //!< 事後処理
private:
struct should_be_SetUp {};
virtual should_be_SetUp* Setup(void) IUTEST_CXX_FINAL { return NULL; }
};

/**
Expand Down Expand Up @@ -143,6 +146,7 @@ class TestFlag

PRINT_TIME = 0x00001000, //!< 経過時間の出力
FILELOCATION_STYLE_MSVC = 0x00002000, //!< ファイル/行出力スタイルを Visual Studio スタイルにする
VERBOSE = 0x00004000, //!< verbose

CATCH_EXCEPTION_EACH = 0x00010000, //!< 例外を catch する(TestInfo)
CATCH_EXCEPTION_GLOBAL = 0x00020000, //!< 例外を catch する(UnitTest)
Expand Down
6 changes: 4 additions & 2 deletions include/iutest_ver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

//======================================================================
// define
#define IUTEST_VER 0x01099921u //!< iutest version 1.9.99.21
#define IUTEST_VER 0x01099922u //!< iutest version 1.9.99.22
#define IUTEST_MAJORVER 0x01u //!< Major Version
#define IUTEST_MINORVER 0x09u //!< Minor Version
#define IUTEST_BUILD 0x99u //!< Build
#define IUTEST_REVISION 0x21u //!< Revision
#define IUTEST_REVISION 0x22u //!< Revision

/**
* @mainpage
Expand Down Expand Up @@ -82,6 +82,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<tr><td>--iutest_stream_result_to </td><td>&lt;host:port&gt;</td><td>Set stream test results server.</td></tr>
<tr><td>--iutest_file_location </td><td>&lt;auto|vs|gcc&gt;</td><td>Format file location messages.</td></tr>
<tr><td>--iutest_root_package_name </td><td>[name]</td><td>Set root package name.</td></tr>
<tr><td>--verbose </td><td></td><td>Verbose option.</td></tr>
<tr><td>--feature </td><td></td><td>Show iutest feature.</td></tr>
<tr><td>--version, -v </td><td></td><td>Show iutest version.</td></tr>
</table>
Expand Down Expand Up @@ -114,6 +115,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<ul>
<li>v1.10.0.0
<ul>
<li>--verbose コマンドラインオプションを追加</li>
<li>--iutest_root_package_name コマンドラインオプションを追加</li>
<li>operatoer == のないオブジェクトの IUTEST_*_EQ 対応</li>
<li>operatoer != のないオブジェクトの IUTEST_*_NE 対応</li>
Expand Down
1 change: 1 addition & 0 deletions test/CommonMakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ TARGETS2= \

TARGETS_IUTEST_ONLY = \
iutest_default_main_tests \
iutest_default_printer_listener_tests \
iutest_env_var_tests \
iutest_env_var_gtest_tests \
iutest_tap_printer_listener_tests \
Expand Down
3 changes: 3 additions & 0 deletions test/iutest_commandline_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ int main(int argc, char* argv[])
#if IUTEST_HAS_STREAM_RESULT
vargv.push_back("--iutest_stream_result_to=test");
#endif
vargv.push_back("--verbose");

::iutest::InitIrisUnitTest(vargv);
IUTEST_EXPECT_EQ(0, vargv.size());

Expand All @@ -171,6 +173,7 @@ int main(int argc, char* argv[])
#if IUTEST_HAS_STREAM_RESULT
IUTEST_EXPECT_STREQ( "test", ::iutest::IUTEST_FLAG(stream_result_to).c_str() );
#endif
IUTEST_EXPECT_TRUE (::iutest::TestFlag::IsEnableFlag(::iutest::TestFlag::VERBOSE));

if( ::iutest::UnitTest::GetInstance()->Failed() ) return 1;
}
Expand Down
102 changes: 102 additions & 0 deletions test/iutest_default_printer_listener_tests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
//======================================================================
//-----------------------------------------------------------------------
/**
* @file iutest_default_printer_listener_tests.cpp
* @brief QuietResultPrinter test
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2014, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
//-----------------------------------------------------------------------
//======================================================================

//======================================================================
// include
#include "../include/iutest.hpp"
#include "iutest_logger_tests.hpp"

TestLogger logger;

class LoggerClear : public ::iutest::Environment
{
private:
virtual void TearDown(void)
{
logger.clear();
}
};

IUTEST(Test, Ok)
{
}

IUTEST(Test, NG)
{
IUTEST_ASSERT_TRUE(false);
}

IUTEST(Test, Skip)
{
IUTEST_SKIP();
}

IUTEST(DISABLED_Test, NotRun)
{
}

#ifdef UNICODE
int wmain(int argc, wchar_t* argv[])
#else
int main(int argc, char* argv[])
#endif
{
IUTEST_INIT(&argc, argv);
#if defined(OUTPUTXML)
// 実行対象テストがないので xml 出力しない
::iutest::IUTEST_FLAG(output) = NULL;
#endif

::iutest::AddGlobalTestEnvironment(new LoggerClear());
::iutest::detail::iuConsole::SetLogger(&logger);

::iutest::IUTEST_FLAG(color) = "no";

{
::iutest::TestFlag::SetFlag(0, ~::iutest::TestFlag::VERBOSE);

if( IUTEST_RUN_ALL_TESTS() == 0 ) return 1;
#if IUTEST_HAS_ASSERTION_RETURN
IUTEST_ASSERT_STRIN("[ DISABLED ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRIN("[ SKIPPED ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRIN("[ PASSED ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRIN("[ FAILED ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);

IUTEST_ASSERT_STRNOTIN("[ DISABLED ] DISABLED_Test.NotRun", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRNOTIN("[ SKIPPED ] Test.Skip", logger.c_str()) << ::iutest::AssertionReturn<int>(1);

IUTEST_ASSERT_STRNOTIN("[ OK ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
#endif
}
{
::iutest::TestFlag::SetFlag(::iutest::TestFlag::VERBOSE);

if( IUTEST_RUN_ALL_TESTS() == 0 ) return 1;
#if IUTEST_HAS_ASSERTION_RETURN
IUTEST_ASSERT_STRIN("[ DISABLED ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRIN("[ SKIPPED ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRIN("[ PASSED ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRIN("[ FAILED ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);

IUTEST_ASSERT_STRIN("[ DISABLED ] DISABLED_Test.NotRun", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRIN("[ SKIPPED ] Test.Skip", logger.c_str()) << ::iutest::AssertionReturn<int>(1);

IUTEST_ASSERT_STRNOTIN("[ OK ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
#endif
}
printf("*** Successful ***\n");

return 0;
}

0 comments on commit b36b4f7

Please sign in to comment.