MCPcopy Create free account
hub / github.com/cpputest/cpputest / equals

Method equals

src/CppUTestExt/MockNamedValue.cpp:370–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370bool MockNamedValue::equals(const MockNamedValue& p) const
371{
372 if((type_ == "long int") && (p.type_ == "int"))
373 return value_.longIntValue_ == p.value_.intValue_;
374 else if((type_ == "int") && (p.type_ == "long int"))
375 return value_.intValue_ == p.value_.longIntValue_;
376 else if((type_ == "unsigned int") && (p.type_ == "int"))
377 return (p.value_.intValue_ >= 0) && (value_.unsignedIntValue_ == (unsigned int)p.value_.intValue_);
378 else if((type_ == "int") && (p.type_ == "unsigned int"))
379 return (value_.intValue_ >= 0) && ((unsigned int)value_.intValue_ == p.value_.unsignedIntValue_);
380 else if((type_ == "unsigned long int") && (p.type_ == "int"))
381 return (p.value_.intValue_ >= 0) && (value_.unsignedLongIntValue_ == (unsigned long)p.value_.intValue_);
382 else if((type_ == "int") && (p.type_ == "unsigned long int"))
383 return (value_.intValue_ >= 0) && ((unsigned long)value_.intValue_ == p.value_.unsignedLongIntValue_);
384 else if((type_ == "unsigned int") && (p.type_ == "long int"))
385 return (p.value_.longIntValue_ >= 0) && (value_.unsignedIntValue_ == (unsigned long)p.value_.longIntValue_);
386 else if((type_ == "long int") && (p.type_ == "unsigned int"))
387 return (value_.longIntValue_ >= 0) && ((unsigned long)value_.longIntValue_ == p.value_.unsignedIntValue_);
388 else if((type_ == "unsigned int") && (p.type_ == "unsigned long int"))
389 return value_.unsignedIntValue_ == p.value_.unsignedLongIntValue_;
390 else if((type_ == "unsigned long int") && (p.type_ == "unsigned int"))
391 return value_.unsignedLongIntValue_ == p.value_.unsignedIntValue_;
392 else if((type_ == "long int") && (p.type_ == "unsigned long int"))
393 return (value_.longIntValue_ >= 0) && ((unsigned long)value_.longIntValue_ == p.value_.unsignedLongIntValue_);
394 else if((type_ == "unsigned long int") && (p.type_ == "long int"))
395 return (p.value_.longIntValue_ >= 0) && (value_.unsignedLongIntValue_ == (unsigned long) p.value_.longIntValue_);
396#ifdef CPPUTEST_USE_LONG_LONG
397 else if ((type_ == "long long int") && (p.type_ == "int"))
398 return value_.longLongIntValue_ == p.value_.intValue_;
399 else if ((type_ == "int") && (p.type_ == "long long int"))
400 return value_.intValue_ == p.value_.longLongIntValue_;
401 else if ((type_ == "long long int") && (p.type_ == "long int"))
402 return value_.longLongIntValue_ == p.value_.longIntValue_;
403 else if ((type_ == "long int") && (p.type_ == "long long int"))
404 return value_.longIntValue_ == p.value_.longLongIntValue_;
405 else if ((type_ == "long long int") && (p.type_ == "unsigned int"))
406 return (value_.longLongIntValue_ >= 0) && ((unsigned long long)value_.longLongIntValue_ == p.value_.unsignedIntValue_);
407 else if ((type_ == "unsigned int") && (p.type_ == "long long int"))
408 return (p.value_.longLongIntValue_ >= 0) && (value_.unsignedIntValue_ == (unsigned long long)p.value_.longLongIntValue_);
409 else if ((type_ == "long long int") && (p.type_ == "unsigned long int"))
410 return (value_.longLongIntValue_ >= 0) && ((unsigned long long)value_.longLongIntValue_ == p.value_.unsignedLongIntValue_);
411 else if ((type_ == "unsigned long int") && (p.type_ == "long long int"))
412 return (p.value_.longLongIntValue_ >= 0) && (value_.unsignedLongIntValue_ == (unsigned long long)p.value_.longLongIntValue_);
413 else if ((type_ == "long long int") && (p.type_ == "unsigned long long int"))
414 return (value_.longLongIntValue_ >= 0) && ((unsigned long long)value_.longLongIntValue_ == p.value_.unsignedLongLongIntValue_);
415 else if ((type_ == "unsigned long long int") && (p.type_ == "long long int"))
416 return (p.value_.longLongIntValue_ >= 0) && (value_.unsignedLongLongIntValue_ == (unsigned long long)p.value_.longLongIntValue_);
417 else if ((type_ == "unsigned long long int") && (p.type_ == "int"))
418 return (p.value_.intValue_ >= 0) && (value_.unsignedLongLongIntValue_ == (unsigned long long)p.value_.intValue_);
419 else if ((type_ == "int") && (p.type_ == "unsigned long long int"))
420 return (value_.intValue_ >= 0) && ((unsigned long long)value_.intValue_ == p.value_.unsignedLongLongIntValue_);
421 else if ((type_ == "unsigned long long int") && (p.type_ == "unsigned int"))
422 return value_.unsignedLongLongIntValue_ == p.value_.unsignedIntValue_;
423 else if ((type_ == "unsigned int") && (p.type_ == "unsigned long long int"))
424 return value_.unsignedIntValue_ == p.value_.unsignedLongLongIntValue_;
425 else if ((type_ == "unsigned long long int") && (p.type_ == "long int"))
426 return (p.value_.longIntValue_ >= 0) && (value_.unsignedLongLongIntValue_ == (unsigned long long)p.value_.longIntValue_);
427 else if ((type_ == "long int") && (p.type_ == "unsigned long long int"))

Callers 4

hasInputParameterMethod · 0.80
TESTFunction · 0.80
TESTFunction · 0.80
TESTFunction · 0.80

Calls 3

SimpleStringClass · 0.85
doubles_equalFunction · 0.85
isEqualMethod · 0.45

Tested by 3

TESTFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64