16#if !defined(ON_CRASH_TEST_STATICS)
18#error See instructions in the following comment.
66 INT_PTR
i = 0xCACAF00D;
79 INT_PTR
i = 0xCACAF00D;
88 textlog.
Print(
"NULL ptr = %08x\n",ptr);
90 textlog.
Print(
"*ptr = %d\n",*ptr);
99 textlog.
Print(
"Bogus ptr = %08x\n",ptr);
101 textlog.
Print(
"*ptr = %d\n",*ptr);
110 textlog.
Print(
"NULL function f = %08x\n",fptr);
111 *stack_ptr = fptr(crash_type);
112 textlog.
Print(
"f(%d) = %d\n",crash_type,*stack_ptr);
121 textlog.
Print(
"Bogus function f = %08x\n",fptr);
122 *stack_ptr = fptr(crash_type);
123 textlog.
Print(
"f(%d) = %d\n",crash_type,*stack_ptr);
131 sscanf( zero,
"%lg", &z );
133 textlog.
Print(
"float fz = %f\n",fz);
135 textlog.
Print(
"double 13.0f/fz = %f\n",fy);
136 return (0.123f != fy);
143 sscanf( zero,
"%lg", &z );
144 textlog.
Print(
"double z = %g\n",z);
146 textlog.
Print(
"double 13.0/z = %g\n",y);
155 sscanf( zero,
"%lg", &z );
157 textlog.
Print(
"int iz = %d\n",iz);
159 textlog.
Print(
"17/iz = %d\n",iy);
160 return (123456 != iy);
167 sscanf( minus_one,
"%lg", &z );
168 textlog.
Print(
"z = %g\n",z);
170 textlog.
Print(
"log(z) = %g\n",y);
178 sscanf( sx,
"%lg", &x );
179 sscanf( sy,
"%lg", &y );
180 textlog.
Print(
"x = %g y = %g\n",x,y);
182 textlog.
Print(
"x*y = z = %g\n",z);
190 sscanf( si,
"%i", &
i );
191 textlog.
Print(
"i = %d\n",
i);
192 if ( 0==strcmp(
"123",si) )
222#if defined(ON_COMPILER_MSC)
224#pragma warning( push )
225#pragma warning( disable : 4702 )
257 textlog.
Print(
"abort() didn't crash.\n");
262 textlog.
Print(
"exit(99) didn't crash.\n");
268 textlog.
Print(
"Divide by double 0.0 didn't crash - exception must have been handled or ignored.\n");
275 textlog.
Print(
"Divide by float 0.0f didn't crash - exception must have been handled or ignored.\n");
282 textlog.
Print(
"Divide by int 0 didn't crash - exception must have been handled or ignored.\n");
289 textlog.
Print(
"log(negative number) didn't crash - exception must have been handled or ignored.\n");
296 textlog.
Print(
"1.0e200*2.0e222 didn't crash - exception must have been handled or ignored.\n");
303 textlog.
Print(
"throw(123) crash - exception must have been handled or ignored.\n");
314#if defined(ON_COMPILER_MSC)
315#pragma warning( pop )
int i
Copyright (c) 2011-2018 by Andrew Mustun.
Definition autostart.js:32
Definition opennurbs_textlog.h:20
void Print(const char *format,...)
Definition opennurbs_textlog.cpp:105
static int CrashTestHelper_CallBoguslFuncPtr(ON_TextLog &textlog, int crash_type, int *stack_ptr)
Definition opennurbs_crashtest.h:117
static bool CrashTestHelper_LogNegativeNumber(ON_TextLog &textlog, const char *minus_one)
Definition opennurbs_crashtest.h:164
static bool CrashTestHelper_DoubleOverflow(ON_TextLog &textlog, const char *sx, const char *sy)
Definition opennurbs_crashtest.h:175
static bool CrashTestHelper_DivideByDoubleZero(ON_TextLog &textlog, const char *zero)
Definition opennurbs_crashtest.h:140
static void CrashTestHelper_GetNullIntPrt(int **pp)
Definition opennurbs_crashtest.h:58
static bool CrashTestHelper_DivideByFloatZero(ON_TextLog &textlog, const char *zero)
Definition opennurbs_crashtest.h:128
static void CrashTestHelper_GetBogusIntPtr(int **pp)
Definition opennurbs_crashtest.h:64
static int CrashTestHelper(int crash_type, ON_TextLog &textlog)
Definition opennurbs_crashtest.h:229
static void CrashTestHelper_GetNullFuncPtr(CRASHTEST__FUNCTION__POINTER__ *pp)
Definition opennurbs_crashtest.h:71
static bool CrashTestHelper_DivideByIntZero(ON_TextLog &textlog, const char *zero)
Definition opennurbs_crashtest.h:151
static int CrashTestHelper_DerefNullIntPtr(ON_TextLog &textlog, int crash_type, int *stack_ptr)
Definition opennurbs_crashtest.h:84
static int CrashTestHelper_CallNullFuncPtr(ON_TextLog &textlog, int crash_type, int *stack_ptr)
Definition opennurbs_crashtest.h:106
static void CrashTestHelper_GetBogusFuncPtr(CRASHTEST__FUNCTION__POINTER__ *pp)
Definition opennurbs_crashtest.h:77
int(* CRASHTEST__FUNCTION__POINTER__)(int)
Definition opennurbs_crashtest.h:55
static int CrashTestHelper_DerefBogusIntPtr(ON_TextLog &textlog, int crash_type, int *stack_ptr)
Definition opennurbs_crashtest.h:95
static bool CrashTestHelper_Throw(ON_TextLog &textlog, const char *si)
Definition opennurbs_crashtest.h:187
ON_DECL bool ON_IsValid(double x)
Definition opennurbs_point.cpp:18