AUnit  0.5.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
Compare.cpp
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 /*
26 Design Notes:
27 ============
28 
29 Template Specialization:
30 -----------------------
31 One way to implement the compareEqual() for these types is to use template
32 specialization. The problem with Template specialization is that templates
33 use strict type matching, and does not perform the normal implicit type
34 conversion, including const-casting. Therefore, all of the various c-style
35 string types, for example:
36 
37  - char*
38  - const char*
39  - char[1]
40  - char[N]
41  - const char[1]
42  - const char[N]
43 
44 are considered to be different types under the C++ templating system. This
45 causes a combinatorial explosion of template specialization which produces
46 code that is difficult to understand, test and maintain.
47 An example can be seen in the Compare.h file of the ArduinoUnit project:
48 https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnitUtility/Compare.h
49 
50 Function Overloading:
51 ---------------------
52 In this project, I used function overloading instead of template
53 specialization. Function overloading handles c-style strings (i.e. character
54 arrays) naturally, in the way most users expect. For example, (char*) is
55 automarically cast to (const char*), and (char[N]) is autonmatically
56 cast to (const char*).
57 
58 For the primitive value types (e.g. (char), (int), (unsigned char), etc.) I
59 attempted to use a generic templatized version, using sonmething like:
60 
61  template<typename T>
62  compareEqual(const T& a, const T& b) { ... }
63 
64 However, this template introduced this method:
65 
66  compareEqual(char* const& a, char* const& b);
67 
68 that seemed to take precedence over the explicitly defined overload:
69 
70  compareEqual(const char* a, const char*b);
71 
72 When the compareEqual() method is called with a (char*) or a (char[N]),
73 like this:
74 
75  char a[3] = {...};
76  char b[4] = {...};
77  compareEqual(a, b);
78 
79 this calls compareEqual(char* const&, const* const&), which is the wrong
80 version for a c-style string. The only way I could get this to work was to
81 avoid templates completely and manually define all the function overloads
82 even for primitive integer types.
83 
84 Implicit Conversions:
85 ---------------------
86 For basic primitive types, I depend on some casts to avoid having to define
87 some functions. I assume that signed and unsigned integers smaller or equal
88 to (int) will be converted to an (int) to match compareEqual(int, int).
89 
90 I provided an explicit compareEqual(char, char) overload because in C++, a
91 (char) type is distinct from (signed char) and (unsigned char).
92 
93 Technically, there should be a (long long) version and an (unsigned long
94 long) version of compareEqual(). However, it turns out that the Arduino
95 Print::print() method does not have an overload for these types, so it would
96 not do us much good to provide an assertEqual() or compareEqual() for the
97 (long long) and (unsigned long long) types.
98 
99 Custom Assert and Compare Functions:
100 ------------------------------------
101 Another advantage of using function overloading instead of template
102 specialization is that the user is able to add additional function overloads
103 into the 'aunit' namespace. This should allow the user to define the various
104 comporeXxx() and assertXxx() functions for a custom class. I have not
105 tested this though.
106 
107 Comparing Flash Strings:
108 ------------------------
109 Flash memory must be read using 4-byte alignment on the ESP8266. AVR doesn't
110 care. Teensy-ARM fakes the flash memory API but really just uses the normal
111 static RAM. The following code for comparing two (__FlashStringHelper*)
112 against each other will work for all 3 environments.
113 
114 Inlining:
115 --------
116 Even though most of these functions are one-liners, there is no advantage to
117 inlining them because they are almost always used through a function pointer.
118 */
119 
120 #include <string.h>
121 #include <WString.h>
122 #include "Flash.h"
123 #include "Compare.h"
124 #include "FCString.h"
125 
126 namespace aunit {
127 namespace internal {
128 
129 class FCString;
130 
131 //---------------------------------------------------------------------------
132 // compareString()
133 //---------------------------------------------------------------------------
134 
135 int compareString(const char* a, const char* b) {
136  if (a == b) { return 0; }
137  if (a == nullptr) { return -1; }
138  if (b == nullptr) { return 1; }
139  return strcmp(a, b);
140 }
141 
142 int compareString(const char* a, const String& b) {
143  if (a == nullptr) { return -1; }
144  return strcmp(a, b.c_str());
145 }
146 
147 int compareString(const char* a, const __FlashStringHelper* b) {
148  if (a == (const char*)b) { return 0; }
149  if (a == nullptr) { return -1; }
150  if (b == nullptr) { return 1; }
151  return strcmp_P(a, (const char*)b);
152 }
153 
154 int compareString(const String& a, const char* b) {
155  return -compareString(b, a);
156 }
157 
158 int compareString(const String& a, const String& b) {
159  return strcmp(a.c_str(), b.c_str());
160 }
161 
162 int compareString(const String& a, const __FlashStringHelper* b) {
163  if (b == nullptr) { return 1; }
164  return strcmp_P(a.c_str(), (const char*)b);
165 }
166 
167 int compareString(const __FlashStringHelper* a, const char* b) {
168  return -compareString(b, a);
169 }
170 
171 int compareString(const __FlashStringHelper* a, const String& b) {
172  return -compareString(b, a);
173 }
174 
175 // On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
176 // memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
177 // optimizing for 4-byte alignment here.
178 int compareString(const __FlashStringHelper* a, const __FlashStringHelper* b) {
179  if (a == b) { return 0; }
180  if (a == nullptr) { return -1; }
181  if (b == nullptr) { return 1; }
182  const char* aa = reinterpret_cast<const char*>(a);
183  const char* bb = reinterpret_cast<const char*>(b);
184 
185  while (true) {
186  uint8_t ca = pgm_read_byte(aa);
187  uint8_t cb = pgm_read_byte(bb);
188  if (ca != cb) return (int) ca - (int) cb;
189  if (ca == '\0') return 0;
190  aa++;
191  bb++;
192  }
193 }
194 
195 int compareString(const FCString& a, const FCString& b) {
196  if (a.getType() == FCString::kCStringType) {
197  if (b.getType() == FCString::kCStringType) {
198  return compareString(a.getCString(), b.getCString());
199  } else {
200  return compareString(a.getCString(), b.getFString());
201  }
202  } else {
203  if (b.getType() == FCString::kCStringType) {
204  return compareString(a.getFString(), b.getCString());
205  } else {
206  return compareString(a.getFString(), b.getFString());
207  }
208  }
209 }
210 
211 //---------------------------------------------------------------------------
212 // compareStringCase()
213 //---------------------------------------------------------------------------
214 
215 int compareStringCase(const char* a, const char* b) {
216  if (a == b) { return 0; }
217  if (a == nullptr) { return -1; }
218  if (b == nullptr) { return 1; }
219  return strcasecmp(a, b);
220 }
221 
222 int compareStringCase(const char* a, const String& b) {
223  if (a == nullptr) { return -1; }
224  return strcasecmp(a, b.c_str());
225 }
226 
227 int compareStringCase(const char* a, const __FlashStringHelper* b) {
228  if (a == (const char*)b) { return 0; }
229  if (a == nullptr) { return -1; }
230  if (b == nullptr) { return 1; }
231  return strcasecmp_P(a, (const char*)b);
232 }
233 
234 int compareStringCase(const String& a, const char* b) {
235  return -compareStringCase(b, a);
236 }
237 
238 int compareStringCase(const String& a, const String& b) {
239  return strcasecmp(a.c_str(), b.c_str());
240 }
241 
242 int compareStringCase(const String& a, const __FlashStringHelper* b) {
243  if (b == nullptr) { return 1; }
244  return strcasecmp_P(a.c_str(), (const char*)b);
245 }
246 
247 int compareStringCase(const __FlashStringHelper* a, const char* b) {
248  return -compareStringCase(b, a);
249 }
250 
251 int compareStringCase(const __FlashStringHelper* a, const String& b) {
252  return -compareStringCase(b, a);
253 }
254 
255 // On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
256 // memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
257 // optimizing for 4-byte alignment here.
258 int compareStringCase(const __FlashStringHelper* a,
259  const __FlashStringHelper* b) {
260  if (a == b) { return 0; }
261  if (a == nullptr) { return -1; }
262  if (b == nullptr) { return 1; }
263  const char* aa = reinterpret_cast<const char*>(a);
264  const char* bb = reinterpret_cast<const char*>(b);
265 
266  while (true) {
267  uint8_t ca = pgm_read_byte(aa);
268  uint8_t cb = pgm_read_byte(bb);
269  uint8_t la = tolower(ca);
270  uint8_t lb = tolower(cb);
271  if (la != lb) return (int) la - (int) lb;
272  if (ca == '\0') return 0;
273  aa++;
274  bb++;
275  }
276 }
277 
278 //---------------------------------------------------------------------------
279 // compareStringN
280 //---------------------------------------------------------------------------
281 
282 // We need compareStringN() to support only (const char*) and (const
283 // __FlashStringHelper*). And it turns out that compareStringN(a, b, N) ==
284 // -compareString(b, a, N).
285 
286 int compareStringN(const char* a, const char* b, size_t n) {
287  if (a == b) { return 0; }
288  if (a == nullptr) { return -1; }
289  if (b == nullptr) { return 1; }
290  return strncmp(a, b, n);
291 }
292 
293 int compareStringN(const char* a, const __FlashStringHelper* b, size_t n) {
294  if (a == (const char*) b) { return 0; }
295  if (a == nullptr) { return -1; }
296  if (b == nullptr) { return 1; }
297  return strncmp_P(a, (const char*)b, n);
298 }
299 
300 int compareStringN(const __FlashStringHelper* a, const char* b, size_t n) {
301  return -compareStringN(b, a, n);
302 }
303 
304 // On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
305 // memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
306 // optimizing for 4-byte alignment here.
307 int compareStringN(const __FlashStringHelper* a, const __FlashStringHelper* b,
308  size_t n) {
309  if (a == b) { return 0; }
310  if (a == nullptr) { return -1; }
311  if (b == nullptr) { return 1; }
312  const char* aa = reinterpret_cast<const char*>(a);
313  const char* bb = reinterpret_cast<const char*>(b);
314 
315  while (n > 0) {
316  uint8_t ca = pgm_read_byte(aa);
317  uint8_t cb = pgm_read_byte(bb);
318  if (ca != cb) return (int) ca - (int) cb;
319  if (ca == '\0') return 0;
320  aa++;
321  bb++;
322  n--;
323  }
324  return 0;
325 }
326 
327 // Following used only by TestRunner::exclude() and include().
328 
329 int compareStringN(const FCString& a, const char* b, size_t n) {
330  if (a.getType() == FCString::kCStringType) {
331  return compareStringN(a.getCString(), b, n);
332  } else {
333  return compareStringN(a.getFString(), b, n);
334  }
335 }
336 
337 int compareStringN(const FCString& a, const __FlashStringHelper* b, size_t n) {
338  if (a.getType() == FCString::kCStringType) {
339  return compareStringN(a.getCString(), b, n);
340  } else {
341  return compareStringN(a.getFString(), b, n);
342  }
343 }
344 
345 //---------------------------------------------------------------------------
346 // compareEqual()
347 //---------------------------------------------------------------------------
348 
349 bool compareEqual(bool a, bool b) {
350  return (a == b);
351 }
352 
353 bool compareEqual(char a, char b) {
354  return (a == b);
355 }
356 
357 bool compareEqual(int a, int b) {
358  return (a == b);
359 }
360 
361 bool compareEqual(unsigned int a, unsigned int b) {
362  return (a == b);
363 }
364 
365 bool compareEqual(long a, long b) {
366  return (a == b);
367 }
368 
369 bool compareEqual(unsigned long a, unsigned long b) {
370  return (a == b);
371 }
372 
373 bool compareEqual(double a, double b) {
374  return (a == b);
375 }
376 
377 bool compareEqual(const char* a, const char* b) {
378  return compareString(a, b) == 0;
379 }
380 
381 bool compareEqual(const char* a, const String& b) {
382  return compareString(a, b) == 0;
383 }
384 
385 bool compareEqual(const char* a, const __FlashStringHelper* b) {
386  return compareString(a, b) == 0;
387 }
388 
389 bool compareEqual(const __FlashStringHelper* a, const char* b) {
390  return compareString(a, b) == 0;
391 }
392 
393 bool compareEqual(const __FlashStringHelper* a, const __FlashStringHelper* b) {
394  return compareString(a, b) == 0;
395 }
396 
397 bool compareEqual(const __FlashStringHelper* a, const String& b) {
398  return compareString(a, b) == 0;
399 }
400 
401 bool compareEqual(const String& a, const char* b) {
402  return compareString(a, b) == 0;
403 }
404 
405 bool compareEqual(const String& a, const String& b) {
406  return compareString(a, b) == 0;
407 }
408 
409 bool compareEqual(const String& a, const __FlashStringHelper* b) {
410  return compareString(a, b) == 0;
411 }
412 
413 //---------------------------------------------------------------------------
414 // compareLess()
415 //---------------------------------------------------------------------------
416 
417 bool compareLess(bool a, bool b) {
418  return (a < b);
419 }
420 
421 bool compareLess(char a, char b) {
422  return (a < b);
423 }
424 
425 bool compareLess(int a, int b) {
426  return (a < b);
427 }
428 
429 bool compareLess(unsigned int a, unsigned int b) {
430  return (a < b);
431 }
432 
433 bool compareLess(long a, long b) {
434  return (a < b);
435 }
436 
437 bool compareLess(unsigned long a, unsigned long b) {
438  return (a < b);
439 }
440 
441 bool compareLess(double a, double b) {
442  return (a < b);
443 }
444 
445 bool compareLess(const char* a, const char* b) {
446  return compareString(a, b) < 0;
447 }
448 
449 bool compareLess(const char* a, const String& b) {
450  return compareString(a, b) < 0;
451 }
452 
453 bool compareLess(const char* a, const __FlashStringHelper* b) {
454  return compareString(a, b) < 0;
455 }
456 
457 bool compareLess(const __FlashStringHelper* a, const char* b) {
458  return compareString(a, b) < 0;
459 }
460 
461 bool compareLess(
462  const __FlashStringHelper* a, const __FlashStringHelper* b) {
463  return compareString(a, b) < 0;
464 }
465 
466 bool compareLess(const __FlashStringHelper* a, const String& b) {
467  return compareString(a, b) < 0;
468 }
469 
470 bool compareLess(const String& a, const char* b) {
471  return compareString(a, b) < 0;
472 }
473 
474 bool compareLess(const String& a, const String& b) {
475  return compareString(a, b) < 0;
476 }
477 
478 bool compareLess(const String& a, const __FlashStringHelper* b) {
479  return compareString(a, b) < 0;
480 }
481 
482 //---------------------------------------------------------------------------
483 // compareMore()
484 //---------------------------------------------------------------------------
485 
486 bool compareMore(bool a, bool b) {
487  return (a > b);
488 }
489 
490 bool compareMore(char a, char b) {
491  return (a > b);
492 }
493 
494 bool compareMore(int a, int b) {
495  return (a > b);
496 }
497 
498 bool compareMore(unsigned int a, unsigned int b) {
499  return (a > b);
500 }
501 
502 bool compareMore(long a, long b) {
503  return (a > b);
504 }
505 
506 bool compareMore(unsigned long a, unsigned long b) {
507  return (a > b);
508 }
509 
510 bool compareMore(double a, double b) {
511  return (a > b);
512 }
513 
514 bool compareMore(const char* a, const char* b) {
515  return compareString(a, b) > 0;
516 }
517 
518 bool compareMore(const char* a, const String& b) {
519  return compareString(a, b) > 0;
520 }
521 
522 bool compareMore(const char* a, const __FlashStringHelper* b) {
523  return compareString(a, b) > 0;
524 }
525 
526 bool compareMore(const __FlashStringHelper* a, const char* b) {
527  return compareString(a, b) > 0;
528 }
529 
530 bool compareMore(const __FlashStringHelper* a, const __FlashStringHelper* b) {
531  return compareString(a, b) > 0;
532 }
533 
534 bool compareMore(const __FlashStringHelper* a, const String& b) {
535  return compareString(a, b) > 0;
536 }
537 
538 bool compareMore(const String& a, const char* b) {
539  return compareString(a, b) > 0;
540 }
541 
542 bool compareMore(const String& a, const String& b) {
543  return compareString(a, b) > 0;
544 }
545 
546 bool compareMore(const String& a, const __FlashStringHelper* b) {
547  return compareString(a, b) > 0;
548 }
549 
550 //---------------------------------------------------------------------------
551 // compareLessOrEqual
552 //---------------------------------------------------------------------------
553 
554 bool compareLessOrEqual(bool a, bool b) {
555  return (a <= b);
556 }
557 
558 bool compareLessOrEqual(char a, char b) {
559  return (a <= b);
560 }
561 
562 bool compareLessOrEqual(int a, int b) {
563  return (a <= b);
564 }
565 
566 bool compareLessOrEqual(unsigned int a, unsigned int b) {
567  return (a <= b);
568 }
569 
570 bool compareLessOrEqual(long a, long b) {
571  return (a <= b);
572 }
573 
574 bool compareLessOrEqual(unsigned long a, unsigned long b) {
575  return (a <= b);
576 }
577 
578 bool compareLessOrEqual(double a, double b) {
579  return (a <= b);
580 }
581 
582 bool compareLessOrEqual(const char* a, const char* b) {
583  return compareString(a, b) <= 0;
584 }
585 
586 bool compareLessOrEqual(const char* a, const String& b) {
587  return compareString(a, b) <= 0;
588 }
589 
590 bool compareLessOrEqual(const char* a, const __FlashStringHelper* b) {
591  return compareString(a, b) <= 0;
592 }
593 
594 bool compareLessOrEqual(const __FlashStringHelper* a, const char* b) {
595  return compareString(a, b) <= 0;
596 }
597 
598 bool compareLessOrEqual(
599  const __FlashStringHelper* a, const __FlashStringHelper* b) {
600  return compareString(a, b) <= 0;
601 }
602 
603 bool compareLessOrEqual(const __FlashStringHelper* a, const String& b) {
604  return compareString(a, b) <= 0;
605 }
606 
607 bool compareLessOrEqual(const String& a, const char* b) {
608  return compareString(a, b) <= 0;
609 }
610 
611 bool compareLessOrEqual(const String& a, const String& b) {
612  return compareString(a, b) <= 0;
613 }
614 
615 bool compareLessOrEqual(const String& a, const __FlashStringHelper* b) {
616  return compareString(a, b) <= 0;
617 }
618 
619 //---------------------------------------------------------------------------
620 // compareMoreOrEqual
621 //---------------------------------------------------------------------------
622 
623 bool compareMoreOrEqual(bool a, bool b) {
624  return (a >= b);
625 }
626 
627 bool compareMoreOrEqual(char a, char b) {
628  return (a >= b);
629 }
630 
631 bool compareMoreOrEqual(int a, int b) {
632  return (a >= b);
633 }
634 
635 bool compareMoreOrEqual(unsigned int a, unsigned int b) {
636  return (a >= b);
637 }
638 
639 bool compareMoreOrEqual(long a, long b) {
640  return (a >= b);
641 }
642 
643 bool compareMoreOrEqual(unsigned long a, unsigned long b) {
644  return (a >= b);
645 }
646 
647 bool compareMoreOrEqual(double a, double b) {
648  return (a >= b);
649 }
650 
651 bool compareMoreOrEqual(const char* a, const char* b) {
652  return compareString(a, b) >= 0;
653 }
654 
655 bool compareMoreOrEqual(const char* a, const String& b) {
656  return compareString(a, b) >= 0;
657 }
658 
659 bool compareMoreOrEqual(const char* a, const __FlashStringHelper* b) {
660  return compareString(a, b) >= 0;
661 }
662 
663 bool compareMoreOrEqual(const __FlashStringHelper* a, const char* b) {
664  return compareString(a, b) >= 0;
665 }
666 
667 bool compareMoreOrEqual(
668  const __FlashStringHelper* a, const __FlashStringHelper* b) {
669  return compareString(a, b) >= 0;
670 }
671 
672 bool compareMoreOrEqual(const __FlashStringHelper* a, const String& b) {
673  return compareString(a, b) >= 0;
674 }
675 
676 bool compareMoreOrEqual(const String& a, const char* b) {
677  return compareString(a, b) >= 0;
678 }
679 
680 bool compareMoreOrEqual(const String& a, const String& b) {
681  return compareString(a, b) >= 0;
682 }
683 
684 bool compareMoreOrEqual(const String& a, const __FlashStringHelper* b) {
685  return compareString(a, b) >= 0;
686 }
687 
688 //---------------------------------------------------------------------------
689 // compareNotEqual
690 //---------------------------------------------------------------------------
691 
692 bool compareNotEqual(bool a, bool b) {
693  return (a != b);
694 }
695 
696 bool compareNotEqual(char a, char b) {
697  return (a != b);
698 }
699 
700 bool compareNotEqual(int a, int b) {
701  return (a != b);
702 }
703 
704 bool compareNotEqual(unsigned int a, unsigned int b) {
705  return (a != b);
706 }
707 
708 bool compareNotEqual(long a, long b) {
709  return (a != b);
710 }
711 
712 bool compareNotEqual(unsigned long a, unsigned long b) {
713  return (a != b);
714 }
715 
716 bool compareNotEqual(double a, double b) {
717  return (a != b);
718 }
719 
720 bool compareNotEqual(const char* a, const char* b) {
721  return compareString(a, b) != 0;
722 }
723 
724 bool compareNotEqual(const char* a, const String& b) {
725  return compareString(a, b) != 0;
726 }
727 
728 bool compareNotEqual(const char* a, const __FlashStringHelper* b) {
729  return compareString(a, b) != 0;
730 }
731 
732 bool compareNotEqual(const __FlashStringHelper* a, const char* b) {
733  return compareString(a, b) != 0;
734 }
735 
736 bool compareNotEqual(
737  const __FlashStringHelper* a, const __FlashStringHelper* b) {
738  return compareString(a, b) != 0;
739 }
740 
741 bool compareNotEqual(const __FlashStringHelper* a, const String& b) {
742  return compareString(a, b) != 0;
743 }
744 
745 bool compareNotEqual(const String& a, const char* b) {
746  return compareString(a, b) != 0;
747 }
748 
749 bool compareNotEqual(const String& a, const String& b) {
750  return compareString(a, b) != 0;
751 }
752 
753 bool compareNotEqual(const String& a, const __FlashStringHelper* b) {
754  return compareString(a, b) != 0;
755 }
756 
757 //---------------------------------------------------------------------------
758 // compareStringCaseEqual()
759 //---------------------------------------------------------------------------
760 
761 bool compareStringCaseEqual(const char* a, const char* b) {
762  return compareStringCase(a, b) == 0;
763 }
764 
765 bool compareStringCaseEqual(const char* a, const String& b) {
766  return compareStringCase(a, b) == 0;
767 }
768 
769 bool compareStringCaseEqual(const char* a, const __FlashStringHelper* b) {
770  return compareStringCase(a, b) == 0;
771 }
772 
773 bool compareStringCaseEqual(const __FlashStringHelper* a, const char* b) {
774  return compareStringCase(a, b) == 0;
775 }
776 
777 bool compareStringCaseEqual(const __FlashStringHelper* a,
778  const __FlashStringHelper* b) {
779  return compareStringCase(a, b) == 0;
780 }
781 
782 bool compareStringCaseEqual(const __FlashStringHelper* a, const String& b) {
783  return compareStringCase(a, b) == 0;
784 }
785 
786 bool compareStringCaseEqual(const String& a, const char* b) {
787  return compareStringCase(a, b) == 0;
788 }
789 
790 bool compareStringCaseEqual(const String& a, const String& b) {
791  return compareStringCase(a, b) == 0;
792 }
793 
794 bool compareStringCaseEqual(const String& a, const __FlashStringHelper* b) {
795  return compareStringCase(a, b) == 0;
796 }
797 
798 //---------------------------------------------------------------------------
799 // compareStringCaseNotEqual()
800 //---------------------------------------------------------------------------
801 
802 bool compareStringCaseNotEqual(const char* a, const char* b) {
803  return compareStringCase(a, b) != 0;
804 }
805 
806 bool compareStringCaseNotEqual(const char* a, const String& b) {
807  return compareStringCase(a, b) != 0;
808 }
809 
810 bool compareStringCaseNotEqual(const char* a, const __FlashStringHelper* b) {
811  return compareStringCase(a, b) != 0;
812 }
813 
814 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const char* b) {
815  return compareStringCase(a, b) != 0;
816 }
817 
818 bool compareStringCaseNotEqual(const __FlashStringHelper* a,
819  const __FlashStringHelper* b) {
820  return compareStringCase(a, b) != 0;
821 }
822 
823 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const String& b) {
824  return compareStringCase(a, b) != 0;
825 }
826 
827 bool compareStringCaseNotEqual(const String& a, const char* b) {
828  return compareStringCase(a, b) != 0;
829 }
830 
831 bool compareStringCaseNotEqual(const String& a, const String& b) {
832  return compareStringCase(a, b) != 0;
833 }
834 
835 bool compareStringCaseNotEqual(const String& a, const __FlashStringHelper* b) {
836  return compareStringCase(a, b) != 0;
837 }
838 
839 }
840 }
This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a...
Various macros to smooth over the differences among the various platforms with regards to their suppo...