MCPcopy Create free account
hub / github.com/dcleblanc/SafeInt / MultVerifyIntInt64

Function MultVerifyIntInt64

Archive/releases/4/MulTest.cpp:1377–1406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1375};
1376
1377void MultVerifyIntInt64()
1378{
1379 size_t i;
1380
1381 for( i = 0; i < sizeof(int_int64)/sizeof(int_int64[0]); ++i )
1382 {
1383 __int32 ret;
1384 if( SafeMultiply(int_int64[i].x, int_int64[i].y, ret) != int_int64[i].fExpected )
1385 {
1386 //assert(false);
1387 printf("Error in case %I64X, %I64X, expected = %s\n", int_int64[i].x, int_int64[i].y, int_int64[i].fExpected ? "true" : "false");
1388 }
1389
1390 bool fSuccess = true;
1391 try
1392 {
1393 SafeInt<signed __int32> si(int_int64[i].x);
1394 si *= int_int64[i].y;
1395 }
1396 catch(...)
1397 {
1398 fSuccess = false;
1399 }
1400
1401 if( fSuccess != int_int64[i].fExpected )
1402 {
1403 printf("Error in case int_int64 throw: %I64X, %I64X, expected = %s\n", int_int64[i].x, int_int64[i].y, int_int64[i].fExpected ? "true" : "false");
1404 }
1405 }
1406}
1407
1408MultTest< __int32, unsigned __int64 > int_uint64[] =
1409{

Callers 1

MultVerifyFunction · 0.70

Calls 1

SafeMultiplyFunction · 0.70

Tested by

no test coverage detected