mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-06 05:25:29 +00:00
added defines to example Types.h needed by some compilers; reverted changes in return handling that accidentally snuck in previous check in
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@58 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
@@ -36,6 +36,26 @@ typedef char bool;
|
||||
#endif // NULL
|
||||
#define DONT_CARE (0)
|
||||
|
||||
// Floating point edge case defintions
|
||||
#define MATH_NaN (0xFFFFFFFF)
|
||||
#define MATH_POS_INF (0x7F800000)
|
||||
#define MATH_NEG_INF (0xFF800000)
|
||||
|
||||
#define F_TO_U(f) (*(uint32_t*)(&f))
|
||||
#define U_TO_F(u) (*(float*)(u))
|
||||
|
||||
#define IS_NAN(f) ( F_TO_U(f) == MATH_NaN )
|
||||
#define IS_POS_INF(f) ( F_TO_U(f) == MATH_POS_INF )
|
||||
#define IS_NEG_INF(f) ( F_TO_U(f) == MATH_NEG_INF )
|
||||
|
||||
#ifndef INFINITY
|
||||
#define INFINITY (U_TO_F(MATH_POS_INF))
|
||||
#endif
|
||||
|
||||
#ifndef NAN
|
||||
#define NAN MATH_NaN
|
||||
#endif
|
||||
|
||||
// MIN/MAX Definitions for Standard Types
|
||||
#ifndef INT8_MAX
|
||||
#define INT8_MAX 127
|
||||
|
||||
@@ -48,17 +48,16 @@ class CMockGeneratorUtils
|
||||
|
||||
def code_handle_return_value(function, indent)
|
||||
lines = ["\n"]
|
||||
lines << "#{indent}#{function[:rettype]} toReturn;\n"
|
||||
lines << "#{indent}if (Mock.#{function[:name]}_Return != Mock.#{function[:name]}_Return_HeadTail)\n"
|
||||
lines << "#{indent}if(Mock.#{function[:name]}_Return != Mock.#{function[:name]}_Return_HeadTail)\n"
|
||||
lines << "#{indent}{\n"
|
||||
lines << "#{indent}#{@tab}memcpy(&toReturn, Mock.#{function[:name]}_Return, sizeof(#{function[:rettype]}));\n"
|
||||
lines << "#{indent}#{@tab}#{function[:rettype]} toReturn = *Mock.#{function[:name]}_Return;\n"
|
||||
lines << "#{indent}#{@tab}Mock.#{function[:name]}_Return++;\n"
|
||||
lines << "#{indent}#{@tab}return toReturn;\n"
|
||||
lines << "#{indent}}\n"
|
||||
lines << "#{indent}else\n"
|
||||
lines << "#{indent}{\n"
|
||||
lines << "#{indent}#{@tab}memcpy(&toReturn, Mock.#{function[:name]}_Return_Head, sizeof(#{function[:rettype]}));\n"
|
||||
lines << "#{indent}#{@tab}return *Mock.#{function[:name]}_Return_Head;\n"
|
||||
lines << "#{indent}}\n"
|
||||
lines << "#{indent}return toReturn;\n"
|
||||
end
|
||||
|
||||
def code_add_an_arg_expectation(function, arg_type, expected)
|
||||
|
||||
Reference in New Issue
Block a user