arduino_ci 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36ae4dec579913479fdb655f0bf7be717b055149
4
- data.tar.gz: ba9d142cd8c840a9bd54ec84efa4e6351ddc45b0
3
+ metadata.gz: f16bbf16889f4244fd035daa6af2901f48652617
4
+ data.tar.gz: f95a8a86712af293b2e48aa386031ae1a2872f36
5
5
  SHA512:
6
- metadata.gz: dfaefbfed33fa5dc78c8c106311c8896328f3416557a640f1b5366bb3f2278de8993da41386073aca8d274c8de03b405f7b991fdd91068ecf80ff9c3f3bff421
7
- data.tar.gz: 7c56fe74249b2849338a6f439361d658ed49ff9e68b7e5cb3b73d686542a08ada22d45b036d03e0b6196807ed229fa6c0a330f88ba6723b45de2add5b6f351c1
6
+ metadata.gz: 379a7bee7c9c88ce6dcc0abffa990ca67c1a2e2c6b04a5521c4958fa29ba2b65672a1d21e8d1b523f8bc0a098d3cf8e9f9d9c9a97336248855d3890472511a81
7
+ data.tar.gz: 491efe2046ef7414f7adf381c6bd9cf68d7b203c88f644a0a0cd836319611195b0338676a73db4bad3d210f6612071af8e976243f07a4fa17618afa5492d9a43
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # ArduinoCI Ruby gem (`arduino_ci`) [![Gem Version](https://badge.fury.io/rb/arduino_ci.svg)](https://rubygems.org/gems/arduino_ci) [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/arduino_ci/0.1.20)
2
+ # ArduinoCI Ruby gem (`arduino_ci`) [![Gem Version](https://badge.fury.io/rb/arduino_ci.svg)](https://rubygems.org/gems/arduino_ci) [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/arduino_ci/0.1.21)
3
3
 
4
4
  You want to run tests on your Arduino library (bonus: without hardware present), but the IDE doesn't support that. Arduino CI provides that ability.
5
5
 
@@ -15,7 +15,6 @@ Where possible, variable names from the Arduino library are used to avoid confli
15
15
  #include "Stream.h"
16
16
  #include "HardwareSerial.h"
17
17
  #include "SPI.h"
18
- #include "Nullptr.h"
19
18
 
20
19
  typedef bool boolean;
21
20
  typedef uint8_t byte;
@@ -1,5 +1,6 @@
1
1
  #pragma once
2
2
 
3
+ #include "OstreamHelpers.h"
3
4
  #include "Assertion.h"
4
5
  #include <iostream>
5
6
  using namespace std;
@@ -1,7 +1,6 @@
1
1
  #pragma once
2
2
  #include <avr/pgmspace.h>
3
3
  #include <WString.h>
4
- #include <Nullptr.h>
5
4
 
6
5
  template < typename A, typename B > struct Compare
7
6
  {
@@ -10,909 +9,104 @@ template < typename A, typename B > struct Compare
10
9
  if (a<b) return -1;
11
10
  if (b<a) return 1;
12
11
  return 0;
13
- } // between
14
- inline static bool equal(const A &a,const B &b)
15
- {
16
- return (!(a<b)) && (!(b<a));
17
- } // equal
18
- inline static bool notEqual(const A &a,const B &b)
19
- {
20
- return (a<b) || (b<a);
21
- } // notEqual
22
- inline static bool less(const A &a,const B &b)
23
- {
24
- return a<b;
25
- } // less
26
- inline static bool more(const A &a,const B &b)
27
- {
28
- return b<a;
29
- } // more
30
- inline static bool lessOrEqual(const A &a,const B &b)
31
- {
32
- return !(b<a);
33
- } // lessOrEqual
34
- inline static bool moreOrEqual(const A &a,const B &b)
35
- {
36
- return !(a<b);
37
- } // moreOrEqual
38
- };
39
- template < > struct Compare<String,String>;
40
- template < > struct Compare<String,const char *>;
41
- #if defined(F)
42
- template < > struct Compare<String,const __FlashStringHelper *>;
43
- #endif
44
- template < > struct Compare<String,char *>;
45
- template < size_t M > struct Compare<String,char [M]>;
46
- template < > struct Compare<const char *,String>;
47
- template < > struct Compare<const char *,const char *>;
48
- #if defined(F)
49
- template < > struct Compare<const char *,const __FlashStringHelper *>;
50
- #endif
51
- template < > struct Compare<const char *,char *>;
52
- template < size_t M > struct Compare<const char *,char [M]>;
53
- #if defined(F)
54
- template < > struct Compare<const __FlashStringHelper *,String>;
55
- #endif
56
- #if defined(F)
57
- template < > struct Compare<const __FlashStringHelper *,const char *>;
58
- #endif
59
- #if defined(F)
60
- template < > struct Compare<const __FlashStringHelper *,const __FlashStringHelper *>;
61
- #endif
62
- #if defined(F)
63
- template < > struct Compare<const __FlashStringHelper *,char *>;
64
- #endif
65
- #if defined(F)
66
- template < size_t M > struct Compare<const __FlashStringHelper *,char [M]>;
67
- #endif
68
- template < > struct Compare<char *,String>;
69
- template < > struct Compare<char *,const char *>;
70
- #if defined(F)
71
- template < > struct Compare<char *,const __FlashStringHelper *>;
72
- #endif
73
- template < > struct Compare<char *,char *>;
74
- template < size_t M > struct Compare<char *,char [M]>;
75
- template < size_t N > struct Compare<char [N],String>;
76
- template < size_t N > struct Compare<char [N],const char *>;
77
- #if defined(F)
78
- template < size_t N > struct Compare<char [N],const __FlashStringHelper *>;
79
- #endif
80
- template < size_t N > struct Compare<char [N],char *>;
81
- template < size_t N, size_t M > struct Compare<char [N],char [M]>;
82
- template < > struct Compare<String,String>
83
- {
84
- inline static int between(const String &a,const String &b)
85
- {
86
- return a.compareTo(b);
87
- } // between
88
- inline static bool equal(const String &a,const String &b)
89
- {
90
- return between(a,b) == 0;
91
- } // equal
92
- inline static bool notEqual(const String &a,const String &b)
93
- {
94
- return between(a,b) != 0;
95
- } // notEqual
96
- inline static bool less(const String &a,const String &b)
97
- {
98
- return between(a,b) < 0;
99
- } // less
100
- inline static bool more(const String &a,const String &b)
101
- {
102
- return between(a,b) > 0;
103
- } // more
104
- inline static bool lessOrEqual(const String &a,const String &b)
105
- {
106
- return between(a,b) <= 0;
107
- } // lessOrEqual
108
- inline static bool moreOrEqual(const String &a,const String &b)
109
- {
110
- return between(a,b) >= 0;
111
- } // moreOrEqual
112
- };
113
- template < > struct Compare<String,const char *>
114
- {
115
- inline static int between(const String &a,const char * const &b)
116
- {
117
- return a.compareTo(b);
118
- } // between
119
- inline static bool equal(const String &a,const char * const &b)
120
- {
121
- return between(a,b) == 0;
122
- } // equal
123
- inline static bool notEqual(const String &a,const char * const &b)
124
- {
125
- return between(a,b) != 0;
126
- } // notEqual
127
- inline static bool less(const String &a,const char * const &b)
128
- {
129
- return between(a,b) < 0;
130
- } // less
131
- inline static bool more(const String &a,const char * const &b)
132
- {
133
- return between(a,b) > 0;
134
- } // more
135
- inline static bool lessOrEqual(const String &a,const char * const &b)
136
- {
137
- return between(a,b) <= 0;
138
- } // lessOrEqual
139
- inline static bool moreOrEqual(const String &a,const char * const &b)
140
- {
141
- return between(a,b) >= 0;
142
- } // moreOrEqual
12
+ }
13
+ inline static bool equal(const A &a,const B &b) { return (!(a < b)) && (!(b < a)); }
14
+ inline static bool notEqual(const A &a,const B &b) { return (a<b) || (b<a); }
15
+ inline static bool less(const A &a,const B &b) { return a<b; }
16
+ inline static bool more(const A &a,const B &b) { return b<a; }
17
+ inline static bool lessOrEqual(const A &a,const B &b) { return !(b<a); }
18
+ inline static bool moreOrEqual(const A &a,const B &b) { return !(a<b); }
143
19
  };
144
- #if defined(F)
145
- template < > struct Compare<String,const __FlashStringHelper *>
20
+
21
+ // helpers for macros
22
+ inline static int arduinoCICompareBetween(const String &a,const __FlashStringHelper * const &b)
146
23
  {
147
- inline static int between(const String &a,const __FlashStringHelper * const &b)
148
- {
149
- uint8_t a_buf[4],b_buf[4];
150
- uint16_t i=0;
24
+ uint8_t a_buf[4],b_buf[4];
25
+ uint16_t i=0;
151
26
 
152
- for (;;) {
153
- uint8_t j=(i%4);
154
- if (j == 0) {
155
- a.getBytes(a_buf,4,i);
156
- memcpy_P(b_buf,((const char *)b)+i,4);
157
- }
158
- if (a_buf[j] < b_buf[j]) return -1;
159
- if (a_buf[j] > b_buf[j]) return 1;
160
- if (a_buf[j] == 0) return 0;
161
- ++i;
27
+ for (;;) {
28
+ uint8_t j=(i%4);
29
+ if (j == 0) {
30
+ a.getBytes(a_buf,4,i);
31
+ memcpy_P(b_buf,((const char *)b)+i,4);
162
32
  }
163
- } // between
164
- inline static bool equal(const String &a,const __FlashStringHelper * const &b)
165
- {
166
- return between(a,b) == 0;
167
- } // equal
168
- inline static bool notEqual(const String &a,const __FlashStringHelper * const &b)
169
- {
170
- return between(a,b) != 0;
171
- } // notEqual
172
- inline static bool less(const String &a,const __FlashStringHelper * const &b)
173
- {
174
- return between(a,b) < 0;
175
- } // less
176
- inline static bool more(const String &a,const __FlashStringHelper * const &b)
177
- {
178
- return between(a,b) > 0;
179
- } // more
180
- inline static bool lessOrEqual(const String &a,const __FlashStringHelper * const &b)
181
- {
182
- return between(a,b) <= 0;
183
- } // lessOrEqual
184
- inline static bool moreOrEqual(const String &a,const __FlashStringHelper * const &b)
185
- {
186
- return between(a,b) >= 0;
187
- } // moreOrEqual
188
- };
189
- #endif
190
- template < > struct Compare<String,char *>
191
- {
192
- inline static int between(const String &a,char * const &b)
193
- {
194
- return a.compareTo(b);
195
- } // between
196
- inline static bool equal(const String &a,char * const &b)
197
- {
198
- return between(a,b) == 0;
199
- } // equal
200
- inline static bool notEqual(const String &a,char * const &b)
201
- {
202
- return between(a,b) != 0;
203
- } // notEqual
204
- inline static bool less(const String &a,char * const &b)
205
- {
206
- return between(a,b) < 0;
207
- } // less
208
- inline static bool more(const String &a,char * const &b)
209
- {
210
- return between(a,b) > 0;
211
- } // more
212
- inline static bool lessOrEqual(const String &a,char * const &b)
213
- {
214
- return between(a,b) <= 0;
215
- } // lessOrEqual
216
- inline static bool moreOrEqual(const String &a,char * const &b)
217
- {
218
- return between(a,b) >= 0;
219
- } // moreOrEqual
220
- };
221
- template < size_t M > struct Compare<String,char [M]>
222
- {
223
- inline static int between(const String &a,const char (&b)[M])
224
- {
225
- return a.compareTo(b);
226
- } // between
227
- inline static bool equal(const String &a,const char (&b)[M])
228
- {
229
- return between(a,b) == 0;
230
- } // equal
231
- inline static bool notEqual(const String &a,const char (&b)[M])
232
- {
233
- return between(a,b) != 0;
234
- } // notEqual
235
- inline static bool less(const String &a,const char (&b)[M])
236
- {
237
- return between(a,b) < 0;
238
- } // less
239
- inline static bool more(const String &a,const char (&b)[M])
240
- {
241
- return between(a,b) > 0;
242
- } // more
243
- inline static bool lessOrEqual(const String &a,const char (&b)[M])
244
- {
245
- return between(a,b) <= 0;
246
- } // lessOrEqual
247
- inline static bool moreOrEqual(const String &a,const char (&b)[M])
248
- {
249
- return between(a,b) >= 0;
250
- } // moreOrEqual
251
- };
252
- template < > struct Compare<const char *,String>
253
- {
254
- inline static int between(const char * const &a,const String &b)
255
- {
256
- return -b.compareTo(a);
257
- } // between
258
- inline static bool equal(const char * const &a,const String &b)
259
- {
260
- return between(a,b) == 0;
261
- } // equal
262
- inline static bool notEqual(const char * const &a,const String &b)
263
- {
264
- return between(a,b) != 0;
265
- } // notEqual
266
- inline static bool less(const char * const &a,const String &b)
267
- {
268
- return between(a,b) < 0;
269
- } // less
270
- inline static bool more(const char * const &a,const String &b)
271
- {
272
- return between(a,b) > 0;
273
- } // more
274
- inline static bool lessOrEqual(const char * const &a,const String &b)
275
- {
276
- return between(a,b) <= 0;
277
- } // lessOrEqual
278
- inline static bool moreOrEqual(const char * const &a,const String &b)
279
- {
280
- return between(a,b) >= 0;
281
- } // moreOrEqual
282
- };
283
- template < > struct Compare<const char *,const char *>
284
- {
285
- inline static int between(const char * const &a,const char * const &b)
286
- {
287
- return strcmp(a,b);
288
- } // between
289
- inline static bool equal(const char * const &a,const char * const &b)
290
- {
291
- return between(a,b) == 0;
292
- } // equal
293
- inline static bool notEqual(const char * const &a,const char * const &b)
294
- {
295
- return between(a,b) != 0;
296
- } // notEqual
297
- inline static bool less(const char * const &a,const char * const &b)
298
- {
299
- return between(a,b) < 0;
300
- } // less
301
- inline static bool more(const char * const &a,const char * const &b)
302
- {
303
- return between(a,b) > 0;
304
- } // more
305
- inline static bool lessOrEqual(const char * const &a,const char * const &b)
306
- {
307
- return between(a,b) <= 0;
308
- } // lessOrEqual
309
- inline static bool moreOrEqual(const char * const &a,const char * const &b)
310
- {
311
- return between(a,b) >= 0;
312
- } // moreOrEqual
313
- };
314
- #if defined(F)
315
- template < > struct Compare<const char *,const __FlashStringHelper *>
316
- {
317
- inline static int between(const char * const &a,const __FlashStringHelper * const &b)
318
- {
319
- return strcmp_P(a,(const char *)b);
320
- } // between
321
- inline static bool equal(const char * const &a,const __FlashStringHelper * const &b)
322
- {
323
- return between(a,b) == 0;
324
- } // equal
325
- inline static bool notEqual(const char * const &a,const __FlashStringHelper * const &b)
326
- {
327
- return between(a,b) != 0;
328
- } // notEqual
329
- inline static bool less(const char * const &a,const __FlashStringHelper * const &b)
330
- {
331
- return between(a,b) < 0;
332
- } // less
333
- inline static bool more(const char * const &a,const __FlashStringHelper * const &b)
334
- {
335
- return between(a,b) > 0;
336
- } // more
337
- inline static bool lessOrEqual(const char * const &a,const __FlashStringHelper * const &b)
338
- {
339
- return between(a,b) <= 0;
340
- } // lessOrEqual
341
- inline static bool moreOrEqual(const char * const &a,const __FlashStringHelper * const &b)
342
- {
343
- return between(a,b) >= 0;
344
- } // moreOrEqual
345
- };
346
- #endif
347
- template < > struct Compare<const char *,char *>
348
- {
349
- inline static int between(const char * const &a,char * const &b)
350
- {
351
- return strcmp(a,b);
352
- } // between
353
- inline static bool equal(const char * const &a,char * const &b)
354
- {
355
- return between(a,b) == 0;
356
- } // equal
357
- inline static bool notEqual(const char * const &a,char * const &b)
358
- {
359
- return between(a,b) != 0;
360
- } // notEqual
361
- inline static bool less(const char * const &a,char * const &b)
362
- {
363
- return between(a,b) < 0;
364
- } // less
365
- inline static bool more(const char * const &a,char * const &b)
366
- {
367
- return between(a,b) > 0;
368
- } // more
369
- inline static bool lessOrEqual(const char * const &a,char * const &b)
370
- {
371
- return between(a,b) <= 0;
372
- } // lessOrEqual
373
- inline static bool moreOrEqual(const char * const &a,char * const &b)
374
- {
375
- return between(a,b) >= 0;
376
- } // moreOrEqual
377
- };
378
- template < size_t M > struct Compare<const char *,char [M]>
379
- {
380
- inline static int between(const char * const &a,const char (&b)[M])
381
- {
382
- return strcmp(a,b);
383
- } // between
384
- inline static bool equal(const char * const &a,const char (&b)[M])
385
- {
386
- return between(a,b) == 0;
387
- } // equal
388
- inline static bool notEqual(const char * const &a,const char (&b)[M])
389
- {
390
- return between(a,b) != 0;
391
- } // notEqual
392
- inline static bool less(const char * const &a,const char (&b)[M])
393
- {
394
- return between(a,b) < 0;
395
- } // less
396
- inline static bool more(const char * const &a,const char (&b)[M])
397
- {
398
- return between(a,b) > 0;
399
- } // more
400
- inline static bool lessOrEqual(const char * const &a,const char (&b)[M])
401
- {
402
- return between(a,b) <= 0;
403
- } // lessOrEqual
404
- inline static bool moreOrEqual(const char * const &a,const char (&b)[M])
405
- {
406
- return between(a,b) >= 0;
407
- } // moreOrEqual
408
- };
409
- #if defined(F)
410
- template < > struct Compare<const __FlashStringHelper *,String>
411
- {
412
- inline static int between(const __FlashStringHelper * const &a,const String &b)
413
- {
414
- return -Compare < String,const __FlashStringHelper * >::between(b,a);
415
- } // between
416
- inline static bool equal(const __FlashStringHelper * const &a,const String &b)
417
- {
418
- return between(a,b) == 0;
419
- } // equal
420
- inline static bool notEqual(const __FlashStringHelper * const &a,const String &b)
421
- {
422
- return between(a,b) != 0;
423
- } // notEqual
424
- inline static bool less(const __FlashStringHelper * const &a,const String &b)
425
- {
426
- return between(a,b) < 0;
427
- } // less
428
- inline static bool more(const __FlashStringHelper * const &a,const String &b)
429
- {
430
- return between(a,b) > 0;
431
- } // more
432
- inline static bool lessOrEqual(const __FlashStringHelper * const &a,const String &b)
433
- {
434
- return between(a,b) <= 0;
435
- } // lessOrEqual
436
- inline static bool moreOrEqual(const __FlashStringHelper * const &a,const String &b)
437
- {
438
- return between(a,b) >= 0;
439
- } // moreOrEqual
440
- };
441
- #endif
442
- #if defined(F)
443
- template < > struct Compare<const __FlashStringHelper *,const char *>
444
- {
445
- inline static int between(const __FlashStringHelper * const &a,const char * const &b)
446
- {
447
- return -strcmp_P(b,(const char *)a);
448
- } // between
449
- inline static bool equal(const __FlashStringHelper * const &a,const char * const &b)
450
- {
451
- return between(a,b) == 0;
452
- } // equal
453
- inline static bool notEqual(const __FlashStringHelper * const &a,const char * const &b)
454
- {
455
- return between(a,b) != 0;
456
- } // notEqual
457
- inline static bool less(const __FlashStringHelper * const &a,const char * const &b)
458
- {
459
- return between(a,b) < 0;
460
- } // less
461
- inline static bool more(const __FlashStringHelper * const &a,const char * const &b)
462
- {
463
- return between(a,b) > 0;
464
- } // more
465
- inline static bool lessOrEqual(const __FlashStringHelper * const &a,const char * const &b)
466
- {
467
- return between(a,b) <= 0;
468
- } // lessOrEqual
469
- inline static bool moreOrEqual(const __FlashStringHelper * const &a,const char * const &b)
470
- {
471
- return between(a,b) >= 0;
472
- } // moreOrEqual
473
- };
474
- #endif
475
- #if defined(F)
476
- template < > struct Compare<const __FlashStringHelper *,const __FlashStringHelper *>
33
+ if (a_buf[j] < b_buf[j]) return -1;
34
+ if (a_buf[j] > b_buf[j]) return 1;
35
+ if (a_buf[j] == 0) return 0;
36
+ ++i;
37
+ }
38
+ }
39
+
40
+ inline static int arduinoCICompareBetween(const __FlashStringHelper * const &a,const __FlashStringHelper * const &b)
477
41
  {
478
- inline static int between(const __FlashStringHelper * const &a,const __FlashStringHelper * const &b)
479
- {
480
- uint8_t a_buf[4],b_buf[4];
481
- uint16_t i=0;
42
+ uint8_t a_buf[4],b_buf[4];
43
+ uint16_t i=0;
482
44
 
483
- for (;;) {
484
- uint8_t j=(i%4);
485
- if (j == 0) {
486
- memcpy_P(a_buf,((const char *)a)+i,4);
487
- memcpy_P(b_buf,((const char *)b)+i,4);
488
- }
489
- if (a_buf[j] < b_buf[j]) return -1;
490
- if (a_buf[j] > b_buf[j]) return 1;
491
- if (a_buf[j] == 0) return 0;
492
- ++i;
45
+ for (;;) {
46
+ uint8_t j=(i%4);
47
+ if (j == 0) {
48
+ memcpy_P(a_buf,((const char *)a)+i,4);
49
+ memcpy_P(b_buf,((const char *)b)+i,4);
493
50
  }
494
- } // between
495
- inline static bool equal(const __FlashStringHelper * const &a,const __FlashStringHelper * const &b)
496
- {
497
- return between(a,b) == 0;
498
- } // equal
499
- inline static bool notEqual(const __FlashStringHelper * const &a,const __FlashStringHelper * const &b)
500
- {
501
- return between(a,b) != 0;
502
- } // notEqual
503
- inline static bool less(const __FlashStringHelper * const &a,const __FlashStringHelper * const &b)
504
- {
505
- return between(a,b) < 0;
506
- } // less
507
- inline static bool more(const __FlashStringHelper * const &a,const __FlashStringHelper * const &b)
508
- {
509
- return between(a,b) > 0;
510
- } // more
511
- inline static bool lessOrEqual(const __FlashStringHelper * const &a,const __FlashStringHelper * const &b)
512
- {
513
- return between(a,b) <= 0;
514
- } // lessOrEqual
515
- inline static bool moreOrEqual(const __FlashStringHelper * const &a,const __FlashStringHelper * const &b)
516
- {
517
- return between(a,b) >= 0;
518
- } // moreOrEqual
519
- };
520
- #endif
521
- #if defined(F)
522
- template < > struct Compare<const __FlashStringHelper *,char *>
523
- {
524
- inline static int between(const __FlashStringHelper * const &a,char * const &b)
525
- {
526
- return -strcmp_P(b,(const char *)a);
527
- } // between
528
- inline static bool equal(const __FlashStringHelper * const &a,char * const &b)
529
- {
530
- return between(a,b) == 0;
531
- } // equal
532
- inline static bool notEqual(const __FlashStringHelper * const &a,char * const &b)
533
- {
534
- return between(a,b) != 0;
535
- } // notEqual
536
- inline static bool less(const __FlashStringHelper * const &a,char * const &b)
537
- {
538
- return between(a,b) < 0;
539
- } // less
540
- inline static bool more(const __FlashStringHelper * const &a,char * const &b)
541
- {
542
- return between(a,b) > 0;
543
- } // more
544
- inline static bool lessOrEqual(const __FlashStringHelper * const &a,char * const &b)
545
- {
546
- return between(a,b) <= 0;
547
- } // lessOrEqual
548
- inline static bool moreOrEqual(const __FlashStringHelper * const &a,char * const &b)
549
- {
550
- return between(a,b) >= 0;
551
- } // moreOrEqual
552
- };
553
- #endif
554
- #if defined(F)
555
- template < size_t M > struct Compare<const __FlashStringHelper *,char [M]>
556
- {
557
- inline static int between(const __FlashStringHelper * const &a,const char (&b)[M])
558
- {
559
- return -strcmp_P(b,(const char *)a);
560
- } // between
561
- inline static bool equal(const __FlashStringHelper * const &a,const char (&b)[M])
562
- {
563
- return between(a,b) == 0;
564
- } // equal
565
- inline static bool notEqual(const __FlashStringHelper * const &a,const char (&b)[M])
566
- {
567
- return between(a,b) != 0;
568
- } // notEqual
569
- inline static bool less(const __FlashStringHelper * const &a,const char (&b)[M])
570
- {
571
- return between(a,b) < 0;
572
- } // less
573
- inline static bool more(const __FlashStringHelper * const &a,const char (&b)[M])
574
- {
575
- return between(a,b) > 0;
576
- } // more
577
- inline static bool lessOrEqual(const __FlashStringHelper * const &a,const char (&b)[M])
578
- {
579
- return between(a,b) <= 0;
580
- } // lessOrEqual
581
- inline static bool moreOrEqual(const __FlashStringHelper * const &a,const char (&b)[M])
582
- {
583
- return between(a,b) >= 0;
584
- } // moreOrEqual
585
- };
586
- #endif
587
- template < > struct Compare<char *,String>
588
- {
589
- inline static int between(char * const &a,const String &b)
590
- {
591
- return -b.compareTo(a);
592
- } // between
593
- inline static bool equal(char * const &a,const String &b)
594
- {
595
- return between(a,b) == 0;
596
- } // equal
597
- inline static bool notEqual(char * const &a,const String &b)
598
- {
599
- return between(a,b) != 0;
600
- } // notEqual
601
- inline static bool less(char * const &a,const String &b)
602
- {
603
- return between(a,b) < 0;
604
- } // less
605
- inline static bool more(char * const &a,const String &b)
606
- {
607
- return between(a,b) > 0;
608
- } // more
609
- inline static bool lessOrEqual(char * const &a,const String &b)
610
- {
611
- return between(a,b) <= 0;
612
- } // lessOrEqual
613
- inline static bool moreOrEqual(char * const &a,const String &b)
614
- {
615
- return between(a,b) >= 0;
616
- } // moreOrEqual
617
- };
618
- template < > struct Compare<char *,const char *>
619
- {
620
- inline static int between(char * const &a,const char * const &b)
621
- {
622
- return strcmp(a,b);
623
- } // between
624
- inline static bool equal(char * const &a,const char * const &b)
625
- {
626
- return between(a,b) == 0;
627
- } // equal
628
- inline static bool notEqual(char * const &a,const char * const &b)
629
- {
630
- return between(a,b) != 0;
631
- } // notEqual
632
- inline static bool less(char * const &a,const char * const &b)
633
- {
634
- return between(a,b) < 0;
635
- } // less
636
- inline static bool more(char * const &a,const char * const &b)
637
- {
638
- return between(a,b) > 0;
639
- } // more
640
- inline static bool lessOrEqual(char * const &a,const char * const &b)
641
- {
642
- return between(a,b) <= 0;
643
- } // lessOrEqual
644
- inline static bool moreOrEqual(char * const &a,const char * const &b)
645
- {
646
- return between(a,b) >= 0;
647
- } // moreOrEqual
648
- };
649
- #if defined(F)
650
- template < > struct Compare<char *,const __FlashStringHelper *>
651
- {
652
- inline static int between(char * const &a,const __FlashStringHelper * const &b)
653
- {
654
- return strcmp_P(a,(const char *)b);
655
- } // between
656
- inline static bool equal(char * const &a,const __FlashStringHelper * const &b)
657
- {
658
- return between(a,b) == 0;
659
- } // equal
660
- inline static bool notEqual(char * const &a,const __FlashStringHelper * const &b)
661
- {
662
- return between(a,b) != 0;
663
- } // notEqual
664
- inline static bool less(char * const &a,const __FlashStringHelper * const &b)
665
- {
666
- return between(a,b) < 0;
667
- } // less
668
- inline static bool more(char * const &a,const __FlashStringHelper * const &b)
669
- {
670
- return between(a,b) > 0;
671
- } // more
672
- inline static bool lessOrEqual(char * const &a,const __FlashStringHelper * const &b)
673
- {
674
- return between(a,b) <= 0;
675
- } // lessOrEqual
676
- inline static bool moreOrEqual(char * const &a,const __FlashStringHelper * const &b)
677
- {
678
- return between(a,b) >= 0;
679
- } // moreOrEqual
680
- };
681
- #endif
682
- template < > struct Compare<char *,char *>
683
- {
684
- inline static int between(char * const &a,char * const &b)
685
- {
686
- return strcmp(a,b);
687
- } // between
688
- inline static bool equal(char * const &a,char * const &b)
689
- {
690
- return between(a,b) == 0;
691
- } // equal
692
- inline static bool notEqual(char * const &a,char * const &b)
693
- {
694
- return between(a,b) != 0;
695
- } // notEqual
696
- inline static bool less(char * const &a,char * const &b)
697
- {
698
- return between(a,b) < 0;
699
- } // less
700
- inline static bool more(char * const &a,char * const &b)
701
- {
702
- return between(a,b) > 0;
703
- } // more
704
- inline static bool lessOrEqual(char * const &a,char * const &b)
705
- {
706
- return between(a,b) <= 0;
707
- } // lessOrEqual
708
- inline static bool moreOrEqual(char * const &a,char * const &b)
709
- {
710
- return between(a,b) >= 0;
711
- } // moreOrEqual
712
- };
713
- template < size_t M > struct Compare<char *,char [M]>
714
- {
715
- inline static int between(char * const &a,const char (&b)[M])
716
- {
717
- return strcmp(a,b);
718
- } // between
719
- inline static bool equal(char * const &a,const char (&b)[M])
720
- {
721
- return between(a,b) == 0;
722
- } // equal
723
- inline static bool notEqual(char * const &a,const char (&b)[M])
724
- {
725
- return between(a,b) != 0;
726
- } // notEqual
727
- inline static bool less(char * const &a,const char (&b)[M])
728
- {
729
- return between(a,b) < 0;
730
- } // less
731
- inline static bool more(char * const &a,const char (&b)[M])
732
- {
733
- return between(a,b) > 0;
734
- } // more
735
- inline static bool lessOrEqual(char * const &a,const char (&b)[M])
736
- {
737
- return between(a,b) <= 0;
738
- } // lessOrEqual
739
- inline static bool moreOrEqual(char * const &a,const char (&b)[M])
740
- {
741
- return between(a,b) >= 0;
742
- } // moreOrEqual
743
- };
744
- template < size_t N > struct Compare<char [N],String>
745
- {
746
- inline static int between(const char (&a)[N],const String &b)
747
- {
748
- return -b.compareTo(a);
749
- } // between
750
- inline static bool equal(const char (&a)[N],const String &b)
751
- {
752
- return between(a,b) == 0;
753
- } // equal
754
- inline static bool notEqual(const char (&a)[N],const String &b)
755
- {
756
- return between(a,b) != 0;
757
- } // notEqual
758
- inline static bool less(const char (&a)[N],const String &b)
759
- {
760
- return between(a,b) < 0;
761
- } // less
762
- inline static bool more(const char (&a)[N],const String &b)
763
- {
764
- return between(a,b) > 0;
765
- } // more
766
- inline static bool lessOrEqual(const char (&a)[N],const String &b)
767
- {
768
- return between(a,b) <= 0;
769
- } // lessOrEqual
770
- inline static bool moreOrEqual(const char (&a)[N],const String &b)
771
- {
772
- return between(a,b) >= 0;
773
- } // moreOrEqual
774
- };
775
- template < size_t N > struct Compare<char [N],const char *>
776
- {
777
- inline static int between(const char (&a)[N],const char * const &b)
778
- {
779
- return strcmp(a,b);
780
- } // between
781
- inline static bool equal(const char (&a)[N],const char * const &b)
782
- {
783
- return between(a,b) == 0;
784
- } // equal
785
- inline static bool notEqual(const char (&a)[N],const char * const &b)
786
- {
787
- return between(a,b) != 0;
788
- } // notEqual
789
- inline static bool less(const char (&a)[N],const char * const &b)
790
- {
791
- return between(a,b) < 0;
792
- } // less
793
- inline static bool more(const char (&a)[N],const char * const &b)
794
- {
795
- return between(a,b) > 0;
796
- } // more
797
- inline static bool lessOrEqual(const char (&a)[N],const char * const &b)
798
- {
799
- return between(a,b) <= 0;
800
- } // lessOrEqual
801
- inline static bool moreOrEqual(const char (&a)[N],const char * const &b)
802
- {
803
- return between(a,b) >= 0;
804
- } // moreOrEqual
805
- };
806
- #if defined(F)
807
- template < size_t N > struct Compare<char [N],const __FlashStringHelper *>
808
- {
809
- inline static int between(const char (&a)[N],const __FlashStringHelper * const &b)
810
- {
811
- return strcmp_P(a,(const char *)b);
812
- } // between
813
- inline static bool equal(const char (&a)[N],const __FlashStringHelper * const &b)
814
- {
815
- return between(a,b) == 0;
816
- } // equal
817
- inline static bool notEqual(const char (&a)[N],const __FlashStringHelper * const &b)
818
- {
819
- return between(a,b) != 0;
820
- } // notEqual
821
- inline static bool less(const char (&a)[N],const __FlashStringHelper * const &b)
822
- {
823
- return between(a,b) < 0;
824
- } // less
825
- inline static bool more(const char (&a)[N],const __FlashStringHelper * const &b)
826
- {
827
- return between(a,b) > 0;
828
- } // more
829
- inline static bool lessOrEqual(const char (&a)[N],const __FlashStringHelper * const &b)
830
- {
831
- return between(a,b) <= 0;
832
- } // lessOrEqual
833
- inline static bool moreOrEqual(const char (&a)[N],const __FlashStringHelper * const &b)
834
- {
835
- return between(a,b) >= 0;
836
- } // moreOrEqual
837
- };
838
- #endif
839
- template < size_t N > struct Compare<char [N],char *>
840
- {
841
- inline static int between(const char (&a)[N],char * const &b)
842
- {
843
- return strcmp(a,b);
844
- } // between
845
- inline static bool equal(const char (&a)[N],char * const &b)
846
- {
847
- return between(a,b) == 0;
848
- } // equal
849
- inline static bool notEqual(const char (&a)[N],char * const &b)
850
- {
851
- return between(a,b) != 0;
852
- } // notEqual
853
- inline static bool less(const char (&a)[N],char * const &b)
854
- {
855
- return between(a,b) < 0;
856
- } // less
857
- inline static bool more(const char (&a)[N],char * const &b)
858
- {
859
- return between(a,b) > 0;
860
- } // more
861
- inline static bool lessOrEqual(const char (&a)[N],char * const &b)
862
- {
863
- return between(a,b) <= 0;
864
- } // lessOrEqual
865
- inline static bool moreOrEqual(const char (&a)[N],char * const &b)
866
- {
867
- return between(a,b) >= 0;
868
- } // moreOrEqual
869
- };
870
- template < size_t N, size_t M > struct Compare<char [N],char [M]>
871
- {
872
- inline static int between(const char (&a)[N],const char (&b)[M])
873
- {
874
- return strcmp(a,b);
875
- } // between
876
- inline static bool equal(const char (&a)[N],const char (&b)[M])
877
- {
878
- return between(a,b) == 0;
879
- } // equal
880
- inline static bool notEqual(const char (&a)[N],const char (&b)[M])
881
- {
882
- return between(a,b) != 0;
883
- } // notEqual
884
- inline static bool less(const char (&a)[N],const char (&b)[M])
885
- {
886
- return between(a,b) < 0;
887
- } // less
888
- inline static bool more(const char (&a)[N],const char (&b)[M])
889
- {
890
- return between(a,b) > 0;
891
- } // more
892
- inline static bool lessOrEqual(const char (&a)[N],const char (&b)[M])
893
- {
894
- return between(a,b) <= 0;
895
- } // lessOrEqual
896
- inline static bool moreOrEqual(const char (&a)[N],const char (&b)[M])
897
- {
898
- return between(a,b) >= 0;
899
- } // moreOrEqual
900
- };
51
+ if (a_buf[j] < b_buf[j]) return -1;
52
+ if (a_buf[j] > b_buf[j]) return 1;
53
+ if (a_buf[j] == 0) return 0;
54
+ ++i;
55
+ }
56
+ }
57
+
58
+
59
+ // this macro works for all the string-based comparisons
60
+ // but just in case, https://stackoverflow.com/a/13842784/2063546
61
+ #define comparisonTemplateMacro(T1, T1m, T2, T2m, betweenImpl, ...) \
62
+ template < __VA_ARGS__ > struct Compare<T1 T1m, T2 T2m>; \
63
+ template < __VA_ARGS__ > struct Compare<T1 T1m, T2 T2m> \
64
+ { \
65
+ inline static int between( T1 const (&a)T1m, T2 const (&b)T2m) { return betweenImpl; } \
66
+ inline static bool equal( T1 const (&a)T1m, T2 const (&b)T2m) { return between(a, b) == 0; } \
67
+ inline static bool notEqual( T1 const (&a)T1m, T2 const (&b)T2m) { return between(a, b) != 0; } \
68
+ inline static bool less( T1 const (&a)T1m, T2 const (&b)T2m) { return between(a, b) < 0; } \
69
+ inline static bool more( T1 const (&a)T1m, T2 const (&b)T2m) { return between(a, b) > 0; } \
70
+ inline static bool lessOrEqual(T1 const (&a)T1m, T2 const (&b)T2m) { return between(a, b) <= 0; } \
71
+ inline static bool moreOrEqual(T1 const (&a)T1m, T2 const (&b)T2m) { return between(a, b) >= 0; } \
72
+ };
73
+
74
+ comparisonTemplateMacro(String, , String, , a.compareTo(b))
75
+ comparisonTemplateMacro(String, , const char *, , a.compareTo(b))
76
+ #if defined(F)
77
+ comparisonTemplateMacro(String, , const __FlashStringHelper *, , arduinoCICompareBetween(a, b))
78
+ comparisonTemplateMacro(const char *,, const __FlashStringHelper *, , strcmp_P(a,(const char *)b))
79
+ comparisonTemplateMacro(const __FlashStringHelper *, , String, , -arduinoCICompareBetween(b, a))
80
+ comparisonTemplateMacro(const __FlashStringHelper *, , const char *, , -strcmp_P(b,(const char *)a))
81
+ comparisonTemplateMacro(const __FlashStringHelper *, , const __FlashStringHelper *, , arduinoCICompareBetween(a, b))
82
+ comparisonTemplateMacro(const __FlashStringHelper *, , char *, , -strcmp_P(b,(const char *)a))
83
+ comparisonTemplateMacro(char *, , const __FlashStringHelper *, , strcmp_P(a,(const char *)b))
84
+ comparisonTemplateMacro(const __FlashStringHelper *, , char, [M], -strcmp_P(b,(const char *)a), size_t M)
85
+ comparisonTemplateMacro(char, [N], const __FlashStringHelper *, , strcmp_P(a,(const char *)b), size_t N)
86
+ #endif
87
+ comparisonTemplateMacro(String, , char *, , a.compareTo(b))
88
+ comparisonTemplateMacro(const char *, , String, , -b.compareTo(a))
89
+ comparisonTemplateMacro(const char *, , const char *, , strcmp(a,b))
90
+ comparisonTemplateMacro(const char *, , char *, , strcmp(a,b))
91
+ comparisonTemplateMacro(char *, , String, , -b.compareTo(a))
92
+ comparisonTemplateMacro(char *, , const char *, , strcmp(a,b))
93
+ comparisonTemplateMacro(char *, , char *, , strcmp(a,b))
94
+ comparisonTemplateMacro(String, , char, [M], a.compareTo(b), size_t M)
95
+ comparisonTemplateMacro(const char *, , char, [M], strcmp(a,b), size_t M)
96
+ comparisonTemplateMacro(char *, , char, [M], strcmp(a,b), size_t M)
97
+ comparisonTemplateMacro(char, [N], String, , -b.compareTo(a), size_t N)
98
+ comparisonTemplateMacro(char, [N], const char *, , strcmp(a,b), size_t N)
99
+ comparisonTemplateMacro(char, [N], char *, , strcmp(a,b), size_t N)
100
+ comparisonTemplateMacro(char, [N], char, [M], strcmp(a,b), size_t N, size_t M)
901
101
 
902
- // null pointer comparisons
903
- template <typename B> int compareBetween( const my_nullptr_t &a, const B &b) { return Compare<my_nullptr_t,B>::between( a, b); }
904
- template <typename B> bool compareEqual( const my_nullptr_t &a, const B &b) { return Compare<my_nullptr_t,B>::equal( a, b); }
905
- template <typename B> bool compareNotEqual( const my_nullptr_t &a, const B &b) { return Compare<my_nullptr_t,B>::notEqual( a, b); }
906
- template <typename B> bool compareLess( const my_nullptr_t &a, const B &b) { return Compare<my_nullptr_t,B>::less( a, b); }
907
- template <typename B> bool compareMore( const my_nullptr_t &a, const B &b) { return Compare<my_nullptr_t,B>::more( a, b); }
908
- template <typename B> bool compareLessOrEqual(const my_nullptr_t &a, const B &b) { return Compare<my_nullptr_t,B>::lessOrEqual(a, b); }
909
- template <typename B> bool compareMoreOrEqual(const my_nullptr_t &a, const B &b) { return Compare<my_nullptr_t,B>::moreOrEqual(a, b); }
102
+ comparisonTemplateMacro(A, , std::nullptr_t, , a ? 1 : 0, typename A)
103
+ comparisonTemplateMacro(std::nullptr_t, , B, , b ? -1 : 0, typename B)
910
104
 
911
105
  // super general comparisons
912
- template <typename A, typename B> int compareBetween( const A &a, const B &b) { return Compare<A,B>::between( a, b); }
913
- template <typename A, typename B> bool compareEqual( const A &a, const B &b) { return Compare<A,B>::equal( a, b); }
914
- template <typename A, typename B> bool compareNotEqual( const A &a, const B &b) { return Compare<A,B>::notEqual( a, b); }
915
- template <typename A, typename B> bool compareLess( const A &a, const B &b) { return Compare<A,B>::less( a, b); }
916
- template <typename A, typename B> bool compareMore( const A &a, const B &b) { return Compare<A,B>::more( a, b); }
917
- template <typename A, typename B> bool compareLessOrEqual(const A &a, const B &b) { return Compare<A,B>::lessOrEqual(a, b); }
918
- template <typename A, typename B> bool compareMoreOrEqual(const A &a, const B &b) { return Compare<A,B>::moreOrEqual(a, b); }
106
+ template <typename A, typename B> int compareBetween( const A &a, const B &b) { return Compare<A, B>::between( a, b); }
107
+ template <typename A, typename B> bool compareEqual( const A &a, const B &b) { return Compare<A, B>::equal( a, b); }
108
+ template <typename A, typename B> bool compareNotEqual( const A &a, const B &b) { return Compare<A, B>::notEqual( a, b); }
109
+ template <typename A, typename B> bool compareLess( const A &a, const B &b) { return Compare<A, B>::less( a, b); }
110
+ template <typename A, typename B> bool compareMore( const A &a, const B &b) { return Compare<A, B>::more( a, b); }
111
+ template <typename A, typename B> bool compareLessOrEqual(const A &a, const B &b) { return Compare<A, B>::lessOrEqual(a, b); }
112
+ template <typename A, typename B> bool compareMoreOrEqual(const A &a, const B &b) { return Compare<A, B>::moreOrEqual(a, b); }
@@ -0,0 +1,5 @@
1
+ #pragma once
2
+
3
+ #include <ostream>
4
+
5
+ inline std::ostream& operator << (std::ostream& out, const std::nullptr_t &np) { return out << "nullptr"; }
@@ -1,3 +1,3 @@
1
1
  module ArduinoCI
2
- VERSION = "0.1.20".freeze
2
+ VERSION = "0.1.21".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arduino_ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Katz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-31 00:00:00.000000000 Z
11
+ date: 2019-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -129,7 +129,6 @@ files:
129
129
  - cpp/arduino/Godmode.cpp
130
130
  - cpp/arduino/Godmode.h
131
131
  - cpp/arduino/HardwareSerial.h
132
- - cpp/arduino/Nullptr.h
133
132
  - cpp/arduino/PinHistory.h
134
133
  - cpp/arduino/Print.h
135
134
  - cpp/arduino/SPI.h
@@ -424,6 +423,7 @@ files:
424
423
  - cpp/unittest/ArduinoUnitTests.h
425
424
  - cpp/unittest/Assertion.h
426
425
  - cpp/unittest/Compare.h
426
+ - cpp/unittest/OstreamHelpers.h
427
427
  - exe/arduino_ci_remote.rb
428
428
  - exe/arduino_library_location.rb
429
429
  - exe/ensure_arduino_installation.rb
@@ -1,7 +0,0 @@
1
- #pragma once
2
-
3
- // Define C++11 nullptr
4
- typedef void * my_nullptr_t;
5
- #define nullptr (my_nullptr_t)NULL
6
-
7
- inline std::ostream& operator << (std::ostream& out, const my_nullptr_t &np) { return out << "nullptr"; }