28 #include "Assertion.h" 33 using namespace internal;
44 template <
typename A,
typename B>
45 void printAssertionMessage(Print* printer,
bool ok,
const char* file,
46 uint16_t line,
const A& lhs,
const char* opName,
const B& rhs) {
54 printer->print(
"Assertion ");
55 printer->print(ok ?
"passed" :
"failed");
56 printer->print(
": (");
59 printer->print(opName);
64 printer->print(
", file ");
66 printer->print(
", line ");
68 printer->println(
'.');
74 void printAssertionMessage(Print* printer,
bool ok,
const char* file,
75 uint16_t line,
bool lhs,
const char* opName,
bool rhs) {
78 printer->print(
"Assertion ");
79 printer->print(ok ?
"passed" :
"failed");
80 printer->print(
": (");
81 printer->print(lhs ?
"true" :
"false");
83 printer->print(opName);
85 printer->print(rhs ?
"true" :
"false");
87 printer->print(
", file ");
89 printer->print(
", line ");
91 printer->println(
'.');
95 void printAssertionMessage(Print* printer,
bool ok,
const char* file,
96 uint16_t line,
long long& lhs,
const char* opName,
long long& rhs) {
99 printer->print(
"Assertion ");
100 printer->print(ok ?
"passed" :
"failed");
101 printer->print(
": (");
102 print64(*printer, lhs);
103 printer->print(
") ");
104 printer->print(opName);
105 printer->print(
" (");
106 print64(*printer, rhs);
108 printer->print(
", file ");
109 printer->print(file);
110 printer->print(
", line ");
111 printer->print(line);
112 printer->println(
'.');
117 void printAssertionMessage(Print* printer,
bool ok,
const char* file,
118 uint16_t line,
unsigned long long& lhs,
const char* opName,
119 unsigned long long& rhs) {
122 printer->print(
"Assertion ");
123 printer->print(ok ?
"passed" :
"failed");
124 printer->print(
": (");
125 print64(*printer, lhs);
126 printer->print(
") ");
127 printer->print(opName);
128 printer->print(
" (");
129 print64(*printer, rhs);
131 printer->print(
", file ");
132 printer->print(file);
133 printer->print(
", line ");
134 printer->print(line);
135 printer->println(
'.');
142 void printAssertionBoolMessage(Print* printer,
bool ok,
const char* file,
143 uint16_t line,
bool arg,
bool value) {
146 printer->print(
"Assertion ");
147 printer->print(ok ?
"passed" :
"failed");
148 printer->print(
": (");
149 printer->print(arg ?
"true" :
"false");
150 printer->print(
") is ");
151 printer->print(value ?
"true" :
"false");
152 printer->print(
", file ");
153 printer->print(file);
154 printer->print(
", line ");
155 printer->print(line);
156 printer->println(
'.');
159 template <
typename A>
160 void printAssertionNearMessage(Print* printer,
bool ok,
const char* file,
161 uint16_t line,
const A& lhs,
const A& rhs,
const char* opName,
163 printer->print(
"Assertion ");
164 printer->print(ok ?
"passed" :
"failed");
165 printer->print(
": |(");
167 printer->print(
") - (");
169 printer->print(
")| ");
170 printer->print(opName);
171 printer->print(
" (");
172 printer->print(error);
174 printer->print(
", file ");
175 printer->print(file);
176 printer->print(
", line ");
177 printer->print(line);
178 printer->println(
'.');
188 bool Assertion::assertionBool(
const char* file, uint16_t line,
bool arg,
190 if (isDone())
return false;
191 bool ok = (arg == value);
192 if (isOutputEnabled(ok)) {
200 bool Assertion::assertion(
const char* file, uint16_t line,
bool lhs,
201 const char* opName,
bool (*op)(
bool lhs,
bool rhs),
203 if (isDone())
return false;
204 bool ok = op(lhs, rhs);
205 if (isOutputEnabled(ok)) {
213 bool Assertion::assertion(
const char* file, uint16_t line,
char lhs,
214 const char* opName,
bool (*op)(
char lhs,
char rhs),
216 if (isDone())
return false;
217 bool ok = op(lhs, rhs);
218 if (isOutputEnabled(ok)) {
226 bool Assertion::assertion(
const char* file, uint16_t line,
int lhs,
227 const char* opName,
bool (*op)(
int lhs,
int rhs),
229 if (isDone())
return false;
230 bool ok = op(lhs, rhs);
231 if (isOutputEnabled(ok)) {
239 bool Assertion::assertion(
const char* file, uint16_t line,
unsigned int lhs,
240 const char* opName,
bool (*op)(
unsigned int lhs,
unsigned int rhs),
242 if (isDone())
return false;
243 bool ok = op(lhs, rhs);
244 if (isOutputEnabled(ok)) {
252 bool Assertion::assertion(
const char* file, uint16_t line,
long lhs,
253 const char* opName,
bool (*op)(
long lhs,
long rhs),
255 if (isDone())
return false;
256 bool ok = op(lhs, rhs);
257 if (isOutputEnabled(ok)) {
265 bool Assertion::assertion(
const char* file, uint16_t line,
unsigned long lhs,
266 const char* opName,
bool (*op)(
unsigned long lhs,
unsigned long rhs),
268 if (isDone())
return false;
269 bool ok = op(lhs, rhs);
270 if (isOutputEnabled(ok)) {
278 bool Assertion::assertion(
const char* file, uint16_t line,
long long lhs,
279 const char* opName,
bool (*op)(
long long lhs,
long long rhs),
281 if (isDone())
return false;
282 bool ok = op(lhs, rhs);
283 if (isOutputEnabled(ok)) {
291 bool Assertion::assertion(
const char* file, uint16_t line,
292 unsigned long long lhs,
const char* opName,
293 bool (*op)(
unsigned long long lhs,
unsigned long long rhs),
294 unsigned long long rhs) {
295 if (isDone())
return false;
296 bool ok = op(lhs, rhs);
297 if (isOutputEnabled(ok)) {
305 bool Assertion::assertion(
const char* file, uint16_t line,
double lhs,
306 const char* opName,
bool (*op)(
double lhs,
double rhs),
308 if (isDone())
return false;
309 bool ok = op(lhs, rhs);
310 if (isOutputEnabled(ok)) {
318 bool Assertion::assertion(
const char* file, uint16_t line,
const char* lhs,
319 const char* opName,
bool (*op)(
const char* lhs,
const char* rhs),
321 if (isDone())
return false;
322 bool ok = op(lhs, rhs);
323 if (isOutputEnabled(ok)) {
331 bool Assertion::assertion(
const char* file, uint16_t line,
const char* lhs,
332 const char* opName,
bool (*op)(
const char* lhs,
const String& rhs),
334 if (isDone())
return false;
335 bool ok = op(lhs, rhs);
336 if (isOutputEnabled(ok)) {
344 bool Assertion::assertion(
const char* file, uint16_t line,
const char* lhs,
346 bool (*op)(
const char* lhs,
const __FlashStringHelper* rhs),
347 const __FlashStringHelper* rhs) {
348 if (isDone())
return false;
349 bool ok = op(lhs, rhs);
350 if (isOutputEnabled(ok)) {
358 bool Assertion::assertion(
const char* file, uint16_t line,
const String& lhs,
359 const char* opName,
bool (*op)(
const String& lhs,
const char* rhs),
361 if (isDone())
return false;
362 bool ok = op(lhs, rhs);
363 if (isOutputEnabled(ok)) {
371 bool Assertion::assertion(
const char* file, uint16_t line,
const String& lhs,
372 const char* opName,
bool (*op)(
const String& lhs,
const String& rhs),
374 if (isDone())
return false;
375 bool ok = op(lhs, rhs);
376 if (isOutputEnabled(ok)) {
384 bool Assertion::assertion(
const char* file, uint16_t line,
const String& lhs,
386 bool (*op)(
const String& lhs,
const __FlashStringHelper* rhs),
387 const __FlashStringHelper* rhs) {
388 if (isDone())
return false;
389 bool ok = op(lhs, rhs);
390 if (isOutputEnabled(ok)) {
398 bool Assertion::assertion(
const char* file, uint16_t line,
399 const __FlashStringHelper* lhs,
const char* opName,
400 bool (*op)(
const __FlashStringHelper* lhs,
const char* rhs),
402 if (isDone())
return false;
403 bool ok = op(lhs, rhs);
404 if (isOutputEnabled(ok)) {
412 bool Assertion::assertion(
const char* file, uint16_t line,
413 const __FlashStringHelper* lhs,
const char* opName,
414 bool (*op)(
const __FlashStringHelper* lhs,
const String& rhs),
416 if (isDone())
return false;
417 bool ok = op(lhs, rhs);
418 if (isOutputEnabled(ok)) {
426 bool Assertion::assertion(
const char* file, uint16_t line,
427 const __FlashStringHelper* lhs,
const char* opName,
428 bool (*op)(
const __FlashStringHelper* lhs,
const __FlashStringHelper* rhs),
429 const __FlashStringHelper* rhs) {
430 if (isDone())
return false;
431 bool ok = op(lhs, rhs);
432 if (isOutputEnabled(ok)) {
440 bool Assertion::assertionNear(
const char* file, uint16_t line,
441 int lhs,
int rhs,
int error,
const char* opName,
442 bool (*opNear)(
int lhs,
int rhs,
int error)) {
443 if (isDone())
return false;
444 bool ok = opNear(lhs, rhs, error);
445 if (isOutputEnabled(ok)) {
447 lhs, rhs, opName, error);
453 bool Assertion::assertionNear(
const char* file, uint16_t line,
454 unsigned int lhs,
unsigned int rhs,
unsigned int error,
const char* opName,
455 bool (*opNear)(
unsigned int lhs,
unsigned int rhs,
unsigned int error)) {
456 if (isDone())
return false;
457 bool ok = opNear(lhs, rhs, error);
458 if (isOutputEnabled(ok)) {
460 lhs, rhs, opName, error);
466 bool Assertion::assertionNear(
const char* file, uint16_t line,
467 long lhs,
long rhs,
long error,
const char* opName,
468 bool (*opNear)(
long lhs,
long rhs,
long error)) {
469 if (isDone())
return false;
470 bool ok = opNear(lhs, rhs, error);
471 if (isOutputEnabled(ok)) {
473 lhs, rhs, opName, error);
479 bool Assertion::assertionNear(
const char* file, uint16_t line,
480 unsigned long lhs,
unsigned long rhs,
unsigned long error,
482 bool (*opNear)(
unsigned long lhs,
unsigned long rhs,
unsigned long error)) {
483 if (isDone())
return false;
484 bool ok = opNear(lhs, rhs, error);
485 if (isOutputEnabled(ok)) {
487 lhs, rhs, opName, error);
493 bool Assertion::assertionNear(
const char* file, uint16_t line,
494 double lhs,
double rhs,
double error,
const char* opName,
495 bool (*opNear)(
double lhs,
double rhs,
double error)) {
496 if (isDone())
return false;
497 bool ok = opNear(lhs, rhs, error);
498 if (isOutputEnabled(ok)) {
500 lhs, rhs, opName, error);
516 template <
typename A,
typename B>
517 void printAssertionMessageVerbose(Print* printer,
bool ok,
const char* file,
518 uint16_t line,
const A& lhs,
const __FlashStringHelper* lhsString,
519 const char* opName,
const B& rhs,
const __FlashStringHelper* rhsString) {
526 printer->print(
"Assertion ");
527 printer->print(ok ?
"passed" :
"failed");
528 printer->print(
": (");
529 printer->print(lhsString);
532 printer->print(
") ");
533 printer->print(opName);
534 printer->print(
" (");
535 printer->print(rhsString);
540 printer->print(
", file ");
541 printer->print(file);
542 printer->print(
", line ");
543 printer->print(line);
544 printer->println(
'.');
550 void printAssertionMessageVerbose(Print* printer,
bool ok,
const char* file,
551 uint16_t line,
bool lhs,
const __FlashStringHelper* lhsString,
552 const char* opName,
bool rhs,
const __FlashStringHelper* rhsString) {
555 printer->print(
"Assertion ");
556 printer->print(ok ?
"passed" :
"failed");
557 printer->print(
": (");
558 printer->print(lhsString);
560 printer->print(lhs ?
"true" :
"false");
561 printer->print(
") ");
562 printer->print(opName);
563 printer->print(
" (");
564 printer->print(rhsString);
566 printer->print(rhs ?
"true" :
"false");
568 printer->print(
", file ");
569 printer->print(file);
570 printer->print(
", line ");
571 printer->print(line);
572 printer->println(
'.');
576 void printAssertionMessageVerbose(Print* printer,
bool ok,
const char* file,
577 uint16_t line,
long long& lhs,
const __FlashStringHelper* lhsString,
578 const char* opName,
long long& rhs,
const __FlashStringHelper* rhsString) {
581 printer->print(
"Assertion ");
582 printer->print(ok ?
"passed" :
"failed");
583 printer->print(
": (");
584 printer->print(lhsString);
586 print64(*printer, lhs);
587 printer->print(
") ");
588 printer->print(opName);
589 printer->print(
" (");
590 printer->print(rhsString);
592 print64(*printer, rhs);
594 printer->print(
", file ");
595 printer->print(file);
596 printer->print(
", line ");
597 printer->print(line);
598 printer->println(
'.');
603 void printAssertionMessageVerbose(Print* printer,
bool ok,
const char* file,
604 uint16_t line,
unsigned long long& lhs,
605 const __FlashStringHelper* lhsString,
const char* opName,
606 unsigned long long& rhs,
const __FlashStringHelper* rhsString) {
609 printer->print(
"Assertion ");
610 printer->print(ok ?
"passed" :
"failed");
611 printer->print(
": (");
612 printer->print(lhsString);
614 print64(*printer, lhs);
615 printer->print(
") ");
616 printer->print(opName);
617 printer->print(
" (");
618 printer->print(rhsString);
620 print64(*printer, rhs);
622 printer->print(
", file ");
623 printer->print(file);
624 printer->print(
", line ");
625 printer->print(line);
626 printer->println(
'.');
633 void printAssertionBoolMessageVerbose(Print* printer,
bool ok,
const char* file,
634 uint16_t line,
bool arg,
const __FlashStringHelper* argString,
bool value) {
637 printer->print(
"Assertion ");
638 printer->print(ok ?
"passed" :
"failed");
639 printer->print(
": (");
640 printer->print(argString);
642 printer->print(arg ?
"true" :
"false");
643 printer->print(
") is ");
644 printer->print(value ?
"true" :
"false");
645 printer->print(
", file ");
646 printer->print(file);
647 printer->print(
", line ");
648 printer->print(line);
649 printer->println(
'.');
652 template <
typename A>
653 void printAssertionNearMessageVerbose(Print* printer,
bool ok,
const char* file,
654 uint16_t line,
const A& lhs,
const __FlashStringHelper* lhsString,
655 const A& rhs,
const __FlashStringHelper* rhsString,
657 const A& error,
const __FlashStringHelper* errorString) {
658 printer->print(
"Assertion ");
659 printer->print(ok ?
"passed" :
"failed");
660 printer->print(
": |(");
661 printer->print(lhsString);
664 printer->print(
") - (");
665 printer->print(rhsString);
668 printer->print(
")| ");
669 printer->print(opName);
670 printer->print(
" (");
671 printer->print(errorString);
673 printer->print(error);
675 printer->print(
", file ");
676 printer->print(file);
677 printer->print(
", line ");
678 printer->print(line);
679 printer->println(
'.');
684 bool Assertion::assertionBoolVerbose(
const char* file, uint16_t line,
bool arg,
685 const __FlashStringHelper* argString,
bool value) {
686 if (isDone())
return false;
687 bool ok = (arg == value);
688 if (isOutputEnabled(ok)) {
690 arg, argString, value);
696 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
bool lhs,
697 const __FlashStringHelper* lhsString,
const char* opName,
698 bool (*op)(
bool lhs,
bool rhs),
bool rhs,
699 const __FlashStringHelper* rhsString) {
700 if (isDone())
return false;
701 bool ok = op(lhs, rhs);
702 if (isOutputEnabled(ok)) {
704 lhs, lhsString, opName, rhs, rhsString);
710 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
char lhs,
711 const __FlashStringHelper* lhsString,
const char* opName,
712 bool (*op)(
char lhs,
char rhs),
char rhs,
713 const __FlashStringHelper* rhsString) {
714 if (isDone())
return false;
715 bool ok = op(lhs, rhs);
716 if (isOutputEnabled(ok)) {
718 lhs, lhsString, opName, rhs, rhsString);
724 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
int lhs,
725 const __FlashStringHelper* lhsString,
const char* opName,
726 bool (*op)(
int lhs,
int rhs),
int rhs,
727 const __FlashStringHelper* rhsString) {
728 if (isDone())
return false;
729 bool ok = op(lhs, rhs);
730 if (isOutputEnabled(ok)) {
732 lhs, lhsString, opName, rhs, rhsString);
738 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
739 unsigned int lhs,
const __FlashStringHelper* lhsString,
const char* opName,
740 bool (*op)(
unsigned int lhs,
unsigned int rhs),
741 unsigned int rhs,
const __FlashStringHelper* rhsString) {
742 if (isDone())
return false;
743 bool ok = op(lhs, rhs);
744 if (isOutputEnabled(ok)) {
746 lhs, lhsString, opName, rhs, rhsString);
752 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
long lhs,
753 const __FlashStringHelper* lhsString,
const char* opName,
754 bool (*op)(
long lhs,
long rhs),
long rhs,
755 const __FlashStringHelper* rhsString) {
756 if (isDone())
return false;
757 bool ok = op(lhs, rhs);
758 if (isOutputEnabled(ok)) {
760 lhs, lhsString, opName, rhs, rhsString);
766 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
767 unsigned long lhs,
const __FlashStringHelper* lhsString,
const char* opName,
768 bool (*op)(
unsigned long lhs,
unsigned long rhs),
769 unsigned long rhs,
const __FlashStringHelper* rhsString) {
770 if (isDone())
return false;
771 bool ok = op(lhs, rhs);
772 if (isOutputEnabled(ok)) {
774 lhs, lhsString, opName, rhs, rhsString);
780 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
long long lhs,
781 const __FlashStringHelper* lhsString,
const char* opName,
782 bool (*op)(
long long lhs,
long long rhs),
long long rhs,
783 const __FlashStringHelper* rhsString) {
784 if (isDone())
return false;
785 bool ok = op(lhs, rhs);
786 if (isOutputEnabled(ok)) {
788 lhs, lhsString, opName, rhs, rhsString);
794 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
795 unsigned long long lhs,
const __FlashStringHelper* lhsString,
797 bool (*op)(
unsigned long long lhs,
unsigned long long rhs),
798 unsigned long long rhs,
const __FlashStringHelper* rhsString) {
799 if (isDone())
return false;
800 bool ok = op(lhs, rhs);
801 if (isOutputEnabled(ok)) {
803 lhs, lhsString, opName, rhs, rhsString);
809 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
double lhs,
810 const __FlashStringHelper* lhsString,
const char* opName,
811 bool (*op)(
double lhs,
double rhs),
double rhs,
812 const __FlashStringHelper* rhsString) {
813 if (isDone())
return false;
814 bool ok = op(lhs, rhs);
815 if (isOutputEnabled(ok)) {
817 lhs, lhsString, opName, rhs, rhsString);
823 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
824 const char* lhs,
const __FlashStringHelper* lhsString,
const char* opName,
825 bool (*op)(
const char* lhs,
const char* rhs),
826 const char* rhs,
const __FlashStringHelper* rhsString) {
827 if (isDone())
return false;
828 bool ok = op(lhs, rhs);
829 if (isOutputEnabled(ok)) {
831 lhs, lhsString, opName, rhs, rhsString);
837 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
838 const char* lhs,
const __FlashStringHelper* lhsString,
839 const char* opName,
bool (*op)(
const char* lhs,
const String& rhs),
840 const String& rhs,
const __FlashStringHelper* rhsString) {
841 if (isDone())
return false;
842 bool ok = op(lhs, rhs);
843 if (isOutputEnabled(ok)) {
845 lhs, lhsString, opName, rhs, rhsString);
851 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
852 const char* lhs,
const __FlashStringHelper* lhsString,
const char* opName,
853 bool (*op)(
const char* lhs,
const __FlashStringHelper* rhs),
854 const __FlashStringHelper* rhs,
const __FlashStringHelper* rhsString) {
855 if (isDone())
return false;
856 bool ok = op(lhs, rhs);
857 if (isOutputEnabled(ok)) {
859 lhs, lhsString, opName, rhs, rhsString);
865 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
866 const String& lhs,
const __FlashStringHelper* lhsString,
const char* opName,
867 bool (*op)(
const String& lhs,
const char* rhs),
868 const char* rhs,
const __FlashStringHelper* rhsString) {
869 if (isDone())
return false;
870 bool ok = op(lhs, rhs);
871 if (isOutputEnabled(ok)) {
873 lhs, lhsString, opName, rhs, rhsString);
879 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
880 const String& lhs,
const __FlashStringHelper* lhsString,
const char* opName,
881 bool (*op)(
const String& lhs,
const String& rhs),
882 const String& rhs,
const __FlashStringHelper* rhsString) {
883 if (isDone())
return false;
884 bool ok = op(lhs, rhs);
885 if (isOutputEnabled(ok)) {
887 lhs, lhsString, opName, rhs, rhsString);
893 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
894 const String& lhs,
const __FlashStringHelper* lhsString,
const char* opName,
895 bool (*op)(
const String& lhs,
const __FlashStringHelper* rhs),
896 const __FlashStringHelper* rhs,
const __FlashStringHelper* rhsString) {
897 if (isDone())
return false;
898 bool ok = op(lhs, rhs);
899 if (isOutputEnabled(ok)) {
901 lhs, lhsString, opName, rhs, rhsString);
907 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
908 const __FlashStringHelper* lhs,
const __FlashStringHelper* lhsString,
910 bool (*op)(
const __FlashStringHelper* lhs,
const char* rhs),
911 const char* rhs,
const __FlashStringHelper* rhsString) {
912 if (isDone())
return false;
913 bool ok = op(lhs, rhs);
914 if (isOutputEnabled(ok)) {
916 lhs, lhsString, opName, rhs, rhsString);
922 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
923 const __FlashStringHelper* lhs,
const __FlashStringHelper* lhsString,
925 bool (*op)(
const __FlashStringHelper* lhs,
const String& rhs),
926 const String& rhs,
const __FlashStringHelper* rhsString) {
927 if (isDone())
return false;
928 bool ok = op(lhs, rhs);
929 if (isOutputEnabled(ok)) {
931 lhs, lhsString, opName, rhs, rhsString);
937 bool Assertion::assertionVerbose(
const char* file, uint16_t line,
938 const __FlashStringHelper* lhs,
const __FlashStringHelper* lhsString,
940 bool (*op)(
const __FlashStringHelper* lhs,
const __FlashStringHelper* rhs),
941 const __FlashStringHelper* rhs,
const __FlashStringHelper* rhsString) {
942 if (isDone())
return false;
943 bool ok = op(lhs, rhs);
944 if (isOutputEnabled(ok)) {
946 lhs, lhsString, opName, rhs, rhsString);
952 bool Assertion::assertionNearVerbose(
const char* file, uint16_t line,
953 int lhs,
const __FlashStringHelper* lhsString,
954 int rhs,
const __FlashStringHelper* rhsString,
955 int error,
const __FlashStringHelper* errorString,
957 bool (*opNear)(
int lhs,
int rhs,
int error)) {
958 if (isDone())
return false;
959 bool ok = opNear(lhs, rhs, error);
960 if (isOutputEnabled(ok)) {
962 lhs, lhsString, rhs, rhsString, opName, error, errorString);
968 bool Assertion::assertionNearVerbose(
const char* file, uint16_t line,
969 unsigned int lhs,
const __FlashStringHelper* lhsString,
970 unsigned int rhs,
const __FlashStringHelper* rhsString,
971 unsigned int error,
const __FlashStringHelper* errorString,
973 bool (*opNear)(
unsigned int lhs,
unsigned int rhs,
unsigned int error)) {
974 if (isDone())
return false;
975 bool ok = opNear(lhs, rhs, error);
976 if (isOutputEnabled(ok)) {
978 lhs, lhsString, rhs, rhsString, opName, error, errorString);
984 bool Assertion::assertionNearVerbose(
const char* file, uint16_t line,
985 long lhs,
const __FlashStringHelper* lhsString,
986 long rhs,
const __FlashStringHelper* rhsString,
987 long error,
const __FlashStringHelper* errorString,
989 bool (*opNear)(
long lhs,
long rhs,
long error)) {
990 if (isDone())
return false;
991 bool ok = opNear(lhs, rhs, error);
992 if (isOutputEnabled(ok)) {
994 lhs, lhsString, rhs, rhsString, opName, error, errorString);
1000 bool Assertion::assertionNearVerbose(
const char* file, uint16_t line,
1001 unsigned long lhs,
const __FlashStringHelper* lhsString,
1002 unsigned long rhs,
const __FlashStringHelper* rhsString,
1003 unsigned long error,
const __FlashStringHelper* errorString,
1005 bool (*opNear)(
unsigned long lhs,
unsigned long rhs,
unsigned long error)) {
1006 if (isDone())
return false;
1007 bool ok = opNear(lhs, rhs, error);
1008 if (isOutputEnabled(ok)) {
1010 lhs, lhsString, rhs, rhsString, opName, error, errorString);
1016 bool Assertion::assertionNearVerbose(
const char* file, uint16_t line,
1017 double lhs,
const __FlashStringHelper* lhsString,
1018 double rhs,
const __FlashStringHelper* rhsString,
1019 double error,
const __FlashStringHelper* errorString,
1021 bool (*opNear)(
double lhs,
double rhs,
double error)) {
1022 if (isDone())
return false;
1023 bool ok = opNear(lhs, rhs, error);
1024 if (isOutputEnabled(ok)) {
1026 lhs, lhsString, rhs, rhsString, opName, error, errorString);
Helper routines to print 'long long' and 'unsigned long long' because the Print::print() methods in P...
static const uint8_t kAssertionPassed
Print assertXxx() passed message.
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
bool isOutputEnabled(bool ok) const
Returns true if an assertion message should be printed.
static const uint8_t kAssertionFailed
Print assertXxx() failed message.
Various macros to smooth over the differences among the various platforms with regards to their suppo...