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

Function MultVerifyInt64Int64

Archive/releases/4/MulTest.cpp:914–943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

912};
913
914void MultVerifyInt64Int64()
915{
916 size_t i;
917
918 for( i = 0; i < sizeof(int64_int64)/sizeof(int64_int64[0]); ++i )
919 {
920 __int64 ret;
921 if( SafeMultiply(int64_int64[i].x, int64_int64[i].y, ret) != int64_int64[i].fExpected )
922 {
923 //assert(false);
924 printf("Error in case %I64X, %I64X, expected = %s\n", int64_int64[i].x, int64_int64[i].y, int64_int64[i].fExpected ? "true" : "false");
925 }
926
927 bool fSuccess = true;
928 try
929 {
930 SafeInt<signed __int64> si(int64_int64[i].x);
931 si *= int64_int64[i].y;
932 }
933 catch(...)
934 {
935 fSuccess = false;
936 }
937
938 if( fSuccess != int64_int64[i].fExpected )
939 {
940 printf("Error in case int64_int64 throw: %I64X, %I64X, expected = %s\n", int64_int64[i].x, int64_int64[i].y, int64_int64[i].fExpected ? "true" : "false");
941 }
942 }
943}
944
945MultTest< __int64, unsigned __int64 > int64_uint64[] =
946{

Callers 1

MultVerifyFunction · 0.70

Calls 1

SafeMultiplyFunction · 0.70

Tested by

no test coverage detected