Skip to content

Commit

Permalink
update r770
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Jan 6, 2015
1 parent 5671d55 commit d327510
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 21 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.11.0.1
PROJECT_NUMBER = 1.11.0.2

# 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
23 changes: 20 additions & 3 deletions include/impl/iutest_port.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2014, Takazumi Shirayanagi\n
* Copyright (C) 2011-2015, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -115,13 +115,30 @@ IUTEST_IPP_INLINE const char* GetCWD(char* buf, size_t length)
#elif defined(IUTEST_OS_WINDOWS)
return ::GetCurrentDirectoryA(static_cast<DWORD>(length), buf) == 0 ? NULL : buf;
#else
return getcwd(buf, length);
const char* result = getcwd(buf, length);
if( result == NULL && buf != NULL && length >= 1 )
{
#if defined(IUTEST_OS_NACL)
if( length < 3 )
{
return NULL;
}
buf[0] = '.';
buf[1] = '/';
buf[2] = '\0';
return buf;
#else
buf[0] = '\0';
return buf;
#endif
}
return result;
#endif
}

IUTEST_IPP_INLINE ::std::string GetCWD(void)
{
char buf[260];
char buf[260] = { 0 };
return GetCWD(buf, sizeof(buf));
}

Expand Down
14 changes: 10 additions & 4 deletions include/internal/iutest_compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2014, Takazumi Shirayanagi\n
* Copyright (C) 2011-2015, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -929,13 +929,19 @@

//! unused attribute
#if !defined(IUTEST_ATTRIBUTE_UNUSED_)
# if (defined(__GNUC__) && !defined(COMPILER_ICC)) || defined(__clang__)
# if (defined(__GNUC__) && !defined(COMPILER_ICC))
# define IUTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
# else
# define IUTEST_ATTRIBUTE_UNUSED_
# elif defined(__clang__)
# if __has_attribute(unused))
# define IUTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
# endif
# endif
#endif

#if !defined(IUTEST_ATTRIBUTE_UNUSED_)
# define IUTEST_ATTRIBUTE_UNUSED_
#endif

//! pure attribute
#if !defined(IUTEST_ATTRIBUTE_PURE_)
# if defined(__GNUC__) && !defined(COMPILER_ICC)
Expand Down
27 changes: 16 additions & 11 deletions include/iutest_assertion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2014, Takazumi Shirayanagi\n
* Copyright (C) 2011-2015, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -414,19 +414,24 @@ inline AssertionResult EqFailure(const char* expected_expression, const char* ac
return AssertionFailure() << strm.str();
}

template<typename T1, typename T2>
inline AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2, const char* op
, const T1& val1, const T2& val2)
{
return AssertionFailure() << "error: Expected: " << expr1 << " " << op << " " << expr2
<< "\n Actual: " << FormatForComparisonFailureMessage(val1, val2)
<< " vs " << FormatForComparisonFailureMessage(val2, val1);
}

/**
* @private
* @{
*/
#define DECL_COMPARE_HELPER_I_(op_name, op, type1, type2) \
inline AssertionResult IUTEST_ATTRIBUTE_UNUSED_ CmpHelper##op_name( \
const char* expr1, const char* expr2, type1 val1, type2 val2) { \
if( val1 op val2 ) { return AssertionSuccess(); \
} else { \
return AssertionFailure() << "error: Expected: " << expr1 << " " #op " " << expr2 \
<< "\n Actual: " << FormatForComparisonFailureMessage(val1, val2) \
<< " vs " << FormatForComparisonFailureMessage(val2, val1); \
} \
*/
#define DECL_COMPARE_HELPER_I_(op_name, op, type1, type2) \
inline AssertionResult IUTEST_ATTRIBUTE_UNUSED_ CmpHelper##op_name( \
const char* expr1, const char* expr2, type1 val1, type2 val2) { \
if( val1 op val2 ) { return AssertionSuccess(); \
} else { return CmpHelperOpFailure(expr1, expr2, #op, val1, val2); } \
}

#if !defined(IUTEST_NO_FUNCTION_TEMPLATE_ORDERING)
Expand Down
4 changes: 2 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 0x01110001u //!< iutest version 1.11.0.1
#define IUTEST_VER 0x01110002u //!< iutest version 1.11.0.2
#define IUTEST_MAJORVER 0x01u //!< Major Version
#define IUTEST_MINORVER 0x11u //!< Minor Version
#define IUTEST_BUILD 0x00u //!< Build
#define IUTEST_REVISION 0x01u //!< Revision
#define IUTEST_REVISION 0x02u //!< Revision

/**
* @mainpage
Expand Down

0 comments on commit d327510

Please sign in to comment.