arduino_ci 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/cpp/arduino/Arduino.cpp +13 -0
- data/cpp/arduino/Arduino.h +19 -0
- data/cpp/arduino/AvrMath.h +37 -0
- data/cpp/unittest/ArduinoUnitTests.cpp +3 -0
- data/cpp/unittest/ArduinoUnitTests.h +212 -0
- data/cpp/unittest/Assertion.h +27 -0
- data/cpp/unittest/Compare.h +334 -0
- data/lib/arduino_ci/version.rb +1 -1
- data/misc/default.yaml +77 -0
- metadata +9 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63c7d8aea63187c680fcac08e18a72469421596e1c4888e4c89bf011b93ef7ab
|
4
|
+
data.tar.gz: 4400ad0218b36e4d0721632674de6dc2cef88126890ca1095b195433e825af74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c720975cb84375e4a10d3781db680a589af77d8af89f4704994180bbe24e2838fe922b13cad50eceb2063403b908c0cc77c7241f6f2692eb9d96443c7cfa7624
|
7
|
+
data.tar.gz: 4bc2267fe4be0b0790bbb31ff4cc339c3e231e723519a428bdf12fdd615f441097dbdd230ce95a47e627b195c0a8afd393a9ac88de04deccef0c73b86fd2b3b0
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[](https://rubygems.org/gems/arduino_ci)
|
2
2
|
[](https://travis-ci.org/ifreecarve/arduino_ci)
|
3
|
-
[](http://www.rubydoc.info/gems/arduino_ci/0.1.
|
3
|
+
[](http://www.rubydoc.info/gems/arduino_ci/0.1.2)
|
4
4
|
|
5
5
|
# ArduinoCI Ruby gem (`arduino_ci`)
|
6
6
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#pragma once
|
2
|
+
/*
|
3
|
+
Mock Arduino.h library.
|
4
|
+
|
5
|
+
Where possible, variable names from the Arduino library are used to avoid conflicts
|
6
|
+
|
7
|
+
*/
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
#include "AvrMath.h"
|
12
|
+
|
13
|
+
struct unit_test_state {
|
14
|
+
unsigned long micros;
|
15
|
+
};
|
16
|
+
|
17
|
+
unsigned long millis();
|
18
|
+
|
19
|
+
unsigned long micros();
|
@@ -0,0 +1,37 @@
|
|
1
|
+
//#include <math.h>
|
2
|
+
#pragma once
|
3
|
+
|
4
|
+
template <typename A> inline A abs(A x) { return x > 0 ? x : -x; }
|
5
|
+
|
6
|
+
//max
|
7
|
+
template <typename A> inline float max(A a, float b) { return a > b ? a : b; }
|
8
|
+
template <typename A> inline float max(float a, A b) { return a > b ? a : b; }
|
9
|
+
template <typename A, typename B> inline long max(A a, B b) { return a > b ? a : b; }
|
10
|
+
|
11
|
+
//min
|
12
|
+
template <typename A> inline float min(A a, float b) { return a < b ? a : b; }
|
13
|
+
template <typename A> inline float min(float a, A b) { return a < b ? a : b; }
|
14
|
+
template <typename A, typename B> inline long min(A a, B b) { return a < b ? a : b; }
|
15
|
+
|
16
|
+
//constrain
|
17
|
+
template <typename A> inline A constrain(A x, A a, A b) { return max(a, min(b, x)); }
|
18
|
+
|
19
|
+
//map
|
20
|
+
template <typename A> inline A map(A x, A in_min, A in_max, A out_min, A out_max)
|
21
|
+
{
|
22
|
+
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
23
|
+
}
|
24
|
+
|
25
|
+
//sq
|
26
|
+
template <typename A> A inline sq(A x) { return x * x; }
|
27
|
+
|
28
|
+
// ??? too lazy to sort these now
|
29
|
+
//pow
|
30
|
+
//sqrt
|
31
|
+
|
32
|
+
// http://www.ganssle.com/approx.htm
|
33
|
+
// http://www.ganssle.com/approx/sincos.cpp
|
34
|
+
//cos
|
35
|
+
//sin
|
36
|
+
//tan
|
37
|
+
|
@@ -0,0 +1,212 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "Assertion.h"
|
4
|
+
#include <iostream>
|
5
|
+
using namespace std;
|
6
|
+
|
7
|
+
struct Results {
|
8
|
+
int passed;
|
9
|
+
int failed;
|
10
|
+
int skipped; // TODO: not sure about this
|
11
|
+
};
|
12
|
+
|
13
|
+
struct TestData {
|
14
|
+
const char* name;
|
15
|
+
int result;
|
16
|
+
};
|
17
|
+
|
18
|
+
class Test
|
19
|
+
{
|
20
|
+
public:
|
21
|
+
class ReporterTAP {
|
22
|
+
private:
|
23
|
+
int mTestCounter;
|
24
|
+
int mAssertCounter;
|
25
|
+
|
26
|
+
public:
|
27
|
+
ReporterTAP() {}
|
28
|
+
~ReporterTAP() {}
|
29
|
+
|
30
|
+
void onTestRunInit(int numTests) {
|
31
|
+
cout << "TAP version 13" << endl;
|
32
|
+
cout << 1 << ".." << numTests << endl; // we know how many tests, in advance
|
33
|
+
mTestCounter = 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
void onTestStart(TestData td) {
|
37
|
+
mAssertCounter = 0;
|
38
|
+
++mTestCounter;
|
39
|
+
cout << "# Subtest: " << td.name << endl;
|
40
|
+
}
|
41
|
+
|
42
|
+
void onTestEnd(TestData td) {
|
43
|
+
cout << " 1.." << mAssertCounter << endl;
|
44
|
+
if (td.result == RESULT_PASS) {
|
45
|
+
cout << "ok " << mTestCounter << " - " << td.name << endl;
|
46
|
+
} else {
|
47
|
+
cout << "not ok " << mTestCounter << " - " << td.name << endl;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
template <typename A, typename B> void onAssert(
|
52
|
+
const char* file,
|
53
|
+
int line,
|
54
|
+
const char* description,
|
55
|
+
bool pass,
|
56
|
+
const char* lhsRelevance,
|
57
|
+
const char* lhsLabel,
|
58
|
+
const A &lhs,
|
59
|
+
const char* opLabel,
|
60
|
+
const char* rhsRelevance,
|
61
|
+
const char* rhsLabel,
|
62
|
+
const B &rhs
|
63
|
+
) {
|
64
|
+
cout << " " << (pass ? "" : "not ") << "ok " << ++mAssertCounter << " - ";
|
65
|
+
cout << description << " " << lhsLabel << " " << opLabel << " " << rhsLabel << endl;
|
66
|
+
if (!pass) {
|
67
|
+
cout << " ---" << endl;
|
68
|
+
cout << " operator: " << opLabel << endl;
|
69
|
+
cout << " " << lhsRelevance << ": " << lhs << endl;
|
70
|
+
cout << " " << rhsRelevance << ": " << rhs << endl;
|
71
|
+
cout << " at:" << endl;
|
72
|
+
cout << " file: " << file << endl;
|
73
|
+
cout << " line: " << line << endl;
|
74
|
+
cout << " ..." << endl;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
private:
|
80
|
+
ReporterTAP* mReporter;
|
81
|
+
const char* mName;
|
82
|
+
|
83
|
+
// linked list structure for active tests
|
84
|
+
static Test* sRoot;
|
85
|
+
Test* mNext;
|
86
|
+
|
87
|
+
void append() {
|
88
|
+
if (!sRoot) return (void)(sRoot = this);
|
89
|
+
Test* p;
|
90
|
+
for (p = sRoot; p->mNext; p = p->mNext);
|
91
|
+
p->mNext = this;
|
92
|
+
}
|
93
|
+
|
94
|
+
void excise() {
|
95
|
+
for (Test **p = &sRoot; *p != 0; p=&((*p)->mNext)) {
|
96
|
+
if (*p == this) return (void)(*p = (*p)->mNext);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
static int numTests() {
|
101
|
+
if (!sRoot) return 0;
|
102
|
+
int i = 1;
|
103
|
+
for (Test* p = sRoot; p->mNext; ++i && (p = p->mNext));
|
104
|
+
return i;
|
105
|
+
}
|
106
|
+
|
107
|
+
// current test result
|
108
|
+
int mResult;
|
109
|
+
|
110
|
+
public:
|
111
|
+
static const int RESULT_NONE = 0;
|
112
|
+
static const int RESULT_PASS = 1;
|
113
|
+
static const int RESULT_FAIL = 2;
|
114
|
+
static const int RESULT_SKIP = 3;
|
115
|
+
|
116
|
+
const inline char *name() { return mName; }
|
117
|
+
const inline int result() { return mResult; }
|
118
|
+
|
119
|
+
Test(const char* _name) : mName(_name) {
|
120
|
+
mResult = RESULT_NONE;
|
121
|
+
mReporter = 0;
|
122
|
+
append();
|
123
|
+
}
|
124
|
+
|
125
|
+
inline void fail() { mResult = RESULT_FAIL; }
|
126
|
+
inline void skip() { mResult = RESULT_SKIP; }
|
127
|
+
|
128
|
+
static Results run(ReporterTAP* reporter) {
|
129
|
+
if (reporter) reporter->onTestRunInit(numTests());
|
130
|
+
Results results = {0, 0, 0};
|
131
|
+
|
132
|
+
for (Test *p = sRoot; p; p = p->mNext) {
|
133
|
+
TestData td = {p->name(), p->result()};
|
134
|
+
p->mReporter = reporter;
|
135
|
+
if (reporter) reporter->onTestStart(td);
|
136
|
+
p->test();
|
137
|
+
if (p->mResult == RESULT_PASS) ++results.passed;
|
138
|
+
if (p->mResult == RESULT_FAIL) ++results.failed;
|
139
|
+
if (p->mResult == RESULT_SKIP) ++results.skipped;
|
140
|
+
if (reporter) reporter->onTestEnd(td);
|
141
|
+
}
|
142
|
+
|
143
|
+
return results;
|
144
|
+
}
|
145
|
+
|
146
|
+
// TODO: figure out TAP output like
|
147
|
+
// https://api.travis-ci.org/v3/job/283745834/log.txt
|
148
|
+
// https://testanything.org/tap-specification.html
|
149
|
+
// parse input and decide how to report
|
150
|
+
static int run_and_report(int argc, char *argv[]) {
|
151
|
+
// TODO: pick a reporter based on args
|
152
|
+
ReporterTAP rep;
|
153
|
+
Results results = run(&rep);
|
154
|
+
return results.failed + results.skipped;
|
155
|
+
}
|
156
|
+
|
157
|
+
void test() {
|
158
|
+
mResult = RESULT_PASS; // not None, and not fail unless we hear otherwise
|
159
|
+
task();
|
160
|
+
}
|
161
|
+
|
162
|
+
virtual void task() = 0;
|
163
|
+
|
164
|
+
virtual ~Test() {
|
165
|
+
excise();
|
166
|
+
}
|
167
|
+
|
168
|
+
template <typename A, typename B>
|
169
|
+
bool assertion(
|
170
|
+
const char *file,
|
171
|
+
int line,
|
172
|
+
const char *description,
|
173
|
+
const char *lhsRelevance,
|
174
|
+
const char *lhsLabel,
|
175
|
+
const A &lhs,
|
176
|
+
|
177
|
+
const char *ops,
|
178
|
+
|
179
|
+
bool (*op)(
|
180
|
+
const A &lhs,
|
181
|
+
const B &rhs),
|
182
|
+
|
183
|
+
const char *rhsRelevance,
|
184
|
+
const char *rhsLabel,
|
185
|
+
const B &rhs)
|
186
|
+
{
|
187
|
+
bool ok = op(lhs, rhs);
|
188
|
+
|
189
|
+
if (mReporter) {
|
190
|
+
mReporter->onAssert(file, line, description, ok,
|
191
|
+
lhsRelevance, lhsLabel, lhs, ops, rhsRelevance, rhsLabel, rhs);
|
192
|
+
}
|
193
|
+
|
194
|
+
if (!ok)
|
195
|
+
fail();
|
196
|
+
return ok;
|
197
|
+
}
|
198
|
+
|
199
|
+
};
|
200
|
+
|
201
|
+
/**
|
202
|
+
* Extend the class into a struct.
|
203
|
+
* The implementation of task() will follow the macro
|
204
|
+
*
|
205
|
+
*/
|
206
|
+
#define unittest(name) \
|
207
|
+
struct test_##name : Test \
|
208
|
+
{ \
|
209
|
+
test_##name() : Test(#name){}; \
|
210
|
+
void task(); \
|
211
|
+
} test_##name##_instance; \
|
212
|
+
void test_##name ::task()
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#pragma once
|
2
|
+
#include "Compare.h"
|
3
|
+
|
4
|
+
// helper define for the operators below
|
5
|
+
#define assertOp(desc, relevance1, arg1, op, op_name, relevance2, arg2) \
|
6
|
+
do \
|
7
|
+
{ \
|
8
|
+
if (!assertion<typeof(arg1), typeof(arg2)>(__FILE__, __LINE__, \
|
9
|
+
desc, \
|
10
|
+
relevance1, #arg1, (arg1), \
|
11
|
+
op_name, op, \
|
12
|
+
relevance2, #arg2, (arg2))) \
|
13
|
+
{ \
|
14
|
+
return; \
|
15
|
+
} \
|
16
|
+
} while (0)
|
17
|
+
|
18
|
+
/** macro generates optional output and calls fail() followed by a return if false. */
|
19
|
+
#define assertEqual(arg1,arg2) assertOp("assertEqual","expected",arg1,compareEqual,"==","actual",arg2)
|
20
|
+
#define assertNotEqual(arg1,arg2) assertOp("assertNotEqual","unwanted",arg1,compareNotEqual,"!=","actual",arg2)
|
21
|
+
#define assertLess(arg1,arg2) assertOp("assertLess","lowerBound",arg1,compareLess,"<","upperBound",arg2)
|
22
|
+
#define assertMore(arg1,arg2) assertOp("assertMore","upperBound",arg1,compareMore,">","lowerBound",arg2)
|
23
|
+
#define assertLessOrEqual(arg1,arg2) assertOp("assertLessOrEqual","lowerBound",arg1,compareLessOrEqual,"<=","upperBound",arg2)
|
24
|
+
#define assertMoreOrEqual(arg1,arg2) assertOp("assertMoreOrEqual","upperBound",arg1,compareMoreOrEqual,">=","lowerBound",arg2)
|
25
|
+
#define assertTrue(arg) assertEqual(arg,true)
|
26
|
+
#define assertFalse(arg) assertEqual(arg,false)
|
27
|
+
|
@@ -0,0 +1,334 @@
|
|
1
|
+
#pragma once
|
2
|
+
#include "string.h"
|
3
|
+
|
4
|
+
|
5
|
+
template < typename A, typename B > struct Compare
|
6
|
+
{
|
7
|
+
inline static int between(const A &a,const B &b)
|
8
|
+
{
|
9
|
+
if (a<b) return -1;
|
10
|
+
if (b<a) return 1;
|
11
|
+
return 0;
|
12
|
+
} // between
|
13
|
+
inline static bool equal(const A &a,const B &b)
|
14
|
+
{
|
15
|
+
return (!(a<b)) && (!(b<a));
|
16
|
+
} // equal
|
17
|
+
inline static bool notEqual(const A &a,const B &b)
|
18
|
+
{
|
19
|
+
return (a<b) || (b<a);
|
20
|
+
} // notEqual
|
21
|
+
inline static bool less(const A &a,const B &b)
|
22
|
+
{
|
23
|
+
return a<b;
|
24
|
+
} // less
|
25
|
+
inline static bool more(const A &a,const B &b)
|
26
|
+
{
|
27
|
+
return b<a;
|
28
|
+
} // more
|
29
|
+
inline static bool lessOrEqual(const A &a,const B &b)
|
30
|
+
{
|
31
|
+
return !(b<a);
|
32
|
+
} // lessOrEqual
|
33
|
+
inline static bool moreOrEqual(const A &a,const B &b)
|
34
|
+
{
|
35
|
+
return !(a<b);
|
36
|
+
} // moreOrEqual
|
37
|
+
};
|
38
|
+
|
39
|
+
template < > struct Compare<const char *,const char *>;
|
40
|
+
template < > struct Compare<const char *,char *>;
|
41
|
+
template < long M > struct Compare<const char *,char [M]>;
|
42
|
+
template < > struct Compare<char *,const char *>;
|
43
|
+
template < > struct Compare<char *,char *>;
|
44
|
+
template < long M > struct Compare<char *,char [M]>;
|
45
|
+
template < long N > struct Compare<char [N],const char *>;
|
46
|
+
template < long N > struct Compare<char [N],char *>;
|
47
|
+
template < long N, long M > struct Compare<char [N],char [M]>;
|
48
|
+
|
49
|
+
template < > struct Compare<const char *,const char *>
|
50
|
+
{
|
51
|
+
inline static int between(const char * const &a,const char * const &b)
|
52
|
+
{
|
53
|
+
return strcmp(a,b);
|
54
|
+
} // between
|
55
|
+
inline static bool equal(const char * const &a,const char * const &b)
|
56
|
+
{
|
57
|
+
return between(a,b) == 0;
|
58
|
+
} // equal
|
59
|
+
inline static bool notEqual(const char * const &a,const char * const &b)
|
60
|
+
{
|
61
|
+
return between(a,b) != 0;
|
62
|
+
} // notEqual
|
63
|
+
inline static bool less(const char * const &a,const char * const &b)
|
64
|
+
{
|
65
|
+
return between(a,b) < 0;
|
66
|
+
} // less
|
67
|
+
inline static bool more(const char * const &a,const char * const &b)
|
68
|
+
{
|
69
|
+
return between(a,b) > 0;
|
70
|
+
} // more
|
71
|
+
inline static bool lessOrEqual(const char * const &a,const char * const &b)
|
72
|
+
{
|
73
|
+
return between(a,b) <= 0;
|
74
|
+
} // lessOrEqual
|
75
|
+
inline static bool moreOrEqual(const char * const &a,const char * const &b)
|
76
|
+
{
|
77
|
+
return between(a,b) >= 0;
|
78
|
+
} // moreOrEqual
|
79
|
+
};
|
80
|
+
template < > struct Compare<const char *,char *>
|
81
|
+
{
|
82
|
+
inline static int between(const char * const &a,char * const &b)
|
83
|
+
{
|
84
|
+
return strcmp(a,b);
|
85
|
+
} // between
|
86
|
+
inline static bool equal(const char * const &a,char * const &b)
|
87
|
+
{
|
88
|
+
return between(a,b) == 0;
|
89
|
+
} // equal
|
90
|
+
inline static bool notEqual(const char * const &a,char * const &b)
|
91
|
+
{
|
92
|
+
return between(a,b) != 0;
|
93
|
+
} // notEqual
|
94
|
+
inline static bool less(const char * const &a,char * const &b)
|
95
|
+
{
|
96
|
+
return between(a,b) < 0;
|
97
|
+
} // less
|
98
|
+
inline static bool more(const char * const &a,char * const &b)
|
99
|
+
{
|
100
|
+
return between(a,b) > 0;
|
101
|
+
} // more
|
102
|
+
inline static bool lessOrEqual(const char * const &a,char * const &b)
|
103
|
+
{
|
104
|
+
return between(a,b) <= 0;
|
105
|
+
} // lessOrEqual
|
106
|
+
inline static bool moreOrEqual(const char * const &a,char * const &b)
|
107
|
+
{
|
108
|
+
return between(a,b) >= 0;
|
109
|
+
} // moreOrEqual
|
110
|
+
};
|
111
|
+
template < long M > struct Compare<const char *,char [M]>
|
112
|
+
{
|
113
|
+
inline static int between(const char * const &a,const char (&b)[M])
|
114
|
+
{
|
115
|
+
return strcmp(a,b);
|
116
|
+
} // between
|
117
|
+
inline static bool equal(const char * const &a,const char (&b)[M])
|
118
|
+
{
|
119
|
+
return between(a,b) == 0;
|
120
|
+
} // equal
|
121
|
+
inline static bool notEqual(const char * const &a,const char (&b)[M])
|
122
|
+
{
|
123
|
+
return between(a,b) != 0;
|
124
|
+
} // notEqual
|
125
|
+
inline static bool less(const char * const &a,const char (&b)[M])
|
126
|
+
{
|
127
|
+
return between(a,b) < 0;
|
128
|
+
} // less
|
129
|
+
inline static bool more(const char * const &a,const char (&b)[M])
|
130
|
+
{
|
131
|
+
return between(a,b) > 0;
|
132
|
+
} // more
|
133
|
+
inline static bool lessOrEqual(const char * const &a,const char (&b)[M])
|
134
|
+
{
|
135
|
+
return between(a,b) <= 0;
|
136
|
+
} // lessOrEqual
|
137
|
+
inline static bool moreOrEqual(const char * const &a,const char (&b)[M])
|
138
|
+
{
|
139
|
+
return between(a,b) >= 0;
|
140
|
+
} // moreOrEqual
|
141
|
+
};
|
142
|
+
template < > struct Compare<char *,const char *>
|
143
|
+
{
|
144
|
+
inline static int between(char * const &a,const char * const &b)
|
145
|
+
{
|
146
|
+
return strcmp(a,b);
|
147
|
+
} // between
|
148
|
+
inline static bool equal(char * const &a,const char * const &b)
|
149
|
+
{
|
150
|
+
return between(a,b) == 0;
|
151
|
+
} // equal
|
152
|
+
inline static bool notEqual(char * const &a,const char * const &b)
|
153
|
+
{
|
154
|
+
return between(a,b) != 0;
|
155
|
+
} // notEqual
|
156
|
+
inline static bool less(char * const &a,const char * const &b)
|
157
|
+
{
|
158
|
+
return between(a,b) < 0;
|
159
|
+
} // less
|
160
|
+
inline static bool more(char * const &a,const char * const &b)
|
161
|
+
{
|
162
|
+
return between(a,b) > 0;
|
163
|
+
} // more
|
164
|
+
inline static bool lessOrEqual(char * const &a,const char * const &b)
|
165
|
+
{
|
166
|
+
return between(a,b) <= 0;
|
167
|
+
} // lessOrEqual
|
168
|
+
inline static bool moreOrEqual(char * const &a,const char * const &b)
|
169
|
+
{
|
170
|
+
return between(a,b) >= 0;
|
171
|
+
} // moreOrEqual
|
172
|
+
};
|
173
|
+
template < > struct Compare<char *,char *>
|
174
|
+
{
|
175
|
+
inline static int between(char * const &a,char * const &b)
|
176
|
+
{
|
177
|
+
return strcmp(a,b);
|
178
|
+
} // between
|
179
|
+
inline static bool equal(char * const &a,char * const &b)
|
180
|
+
{
|
181
|
+
return between(a,b) == 0;
|
182
|
+
} // equal
|
183
|
+
inline static bool notEqual(char * const &a,char * const &b)
|
184
|
+
{
|
185
|
+
return between(a,b) != 0;
|
186
|
+
} // notEqual
|
187
|
+
inline static bool less(char * const &a,char * const &b)
|
188
|
+
{
|
189
|
+
return between(a,b) < 0;
|
190
|
+
} // less
|
191
|
+
inline static bool more(char * const &a,char * const &b)
|
192
|
+
{
|
193
|
+
return between(a,b) > 0;
|
194
|
+
} // more
|
195
|
+
inline static bool lessOrEqual(char * const &a,char * const &b)
|
196
|
+
{
|
197
|
+
return between(a,b) <= 0;
|
198
|
+
} // lessOrEqual
|
199
|
+
inline static bool moreOrEqual(char * const &a,char * const &b)
|
200
|
+
{
|
201
|
+
return between(a,b) >= 0;
|
202
|
+
} // moreOrEqual
|
203
|
+
};
|
204
|
+
template < long M > struct Compare<char *,char [M]>
|
205
|
+
{
|
206
|
+
inline static int between(char * const &a,const char (&b)[M])
|
207
|
+
{
|
208
|
+
return strcmp(a,b);
|
209
|
+
} // between
|
210
|
+
inline static bool equal(char * const &a,const char (&b)[M])
|
211
|
+
{
|
212
|
+
return between(a,b) == 0;
|
213
|
+
} // equal
|
214
|
+
inline static bool notEqual(char * const &a,const char (&b)[M])
|
215
|
+
{
|
216
|
+
return between(a,b) != 0;
|
217
|
+
} // notEqual
|
218
|
+
inline static bool less(char * const &a,const char (&b)[M])
|
219
|
+
{
|
220
|
+
return between(a,b) < 0;
|
221
|
+
} // less
|
222
|
+
inline static bool more(char * const &a,const char (&b)[M])
|
223
|
+
{
|
224
|
+
return between(a,b) > 0;
|
225
|
+
} // more
|
226
|
+
inline static bool lessOrEqual(char * const &a,const char (&b)[M])
|
227
|
+
{
|
228
|
+
return between(a,b) <= 0;
|
229
|
+
} // lessOrEqual
|
230
|
+
inline static bool moreOrEqual(char * const &a,const char (&b)[M])
|
231
|
+
{
|
232
|
+
return between(a,b) >= 0;
|
233
|
+
} // moreOrEqual
|
234
|
+
};
|
235
|
+
template < long N > struct Compare<char [N],const char *>
|
236
|
+
{
|
237
|
+
inline static int between(const char (&a)[N],const char * const &b)
|
238
|
+
{
|
239
|
+
return strcmp(a,b);
|
240
|
+
} // between
|
241
|
+
inline static bool equal(const char (&a)[N],const char * const &b)
|
242
|
+
{
|
243
|
+
return between(a,b) == 0;
|
244
|
+
} // equal
|
245
|
+
inline static bool notEqual(const char (&a)[N],const char * const &b)
|
246
|
+
{
|
247
|
+
return between(a,b) != 0;
|
248
|
+
} // notEqual
|
249
|
+
inline static bool less(const char (&a)[N],const char * const &b)
|
250
|
+
{
|
251
|
+
return between(a,b) < 0;
|
252
|
+
} // less
|
253
|
+
inline static bool more(const char (&a)[N],const char * const &b)
|
254
|
+
{
|
255
|
+
return between(a,b) > 0;
|
256
|
+
} // more
|
257
|
+
inline static bool lessOrEqual(const char (&a)[N],const char * const &b)
|
258
|
+
{
|
259
|
+
return between(a,b) <= 0;
|
260
|
+
} // lessOrEqual
|
261
|
+
inline static bool moreOrEqual(const char (&a)[N],const char * const &b)
|
262
|
+
{
|
263
|
+
return between(a,b) >= 0;
|
264
|
+
} // moreOrEqual
|
265
|
+
};
|
266
|
+
template < long N > struct Compare<char [N],char *>
|
267
|
+
{
|
268
|
+
inline static int between(const char (&a)[N],char * const &b)
|
269
|
+
{
|
270
|
+
return strcmp(a,b);
|
271
|
+
} // between
|
272
|
+
inline static bool equal(const char (&a)[N],char * const &b)
|
273
|
+
{
|
274
|
+
return between(a,b) == 0;
|
275
|
+
} // equal
|
276
|
+
inline static bool notEqual(const char (&a)[N],char * const &b)
|
277
|
+
{
|
278
|
+
return between(a,b) != 0;
|
279
|
+
} // notEqual
|
280
|
+
inline static bool less(const char (&a)[N],char * const &b)
|
281
|
+
{
|
282
|
+
return between(a,b) < 0;
|
283
|
+
} // less
|
284
|
+
inline static bool more(const char (&a)[N],char * const &b)
|
285
|
+
{
|
286
|
+
return between(a,b) > 0;
|
287
|
+
} // more
|
288
|
+
inline static bool lessOrEqual(const char (&a)[N],char * const &b)
|
289
|
+
{
|
290
|
+
return between(a,b) <= 0;
|
291
|
+
} // lessOrEqual
|
292
|
+
inline static bool moreOrEqual(const char (&a)[N],char * const &b)
|
293
|
+
{
|
294
|
+
return between(a,b) >= 0;
|
295
|
+
} // moreOrEqual
|
296
|
+
};
|
297
|
+
template < long N, long M > struct Compare<char [N],char [M]>
|
298
|
+
{
|
299
|
+
inline static int between(const char (&a)[N],const char (&b)[M])
|
300
|
+
{
|
301
|
+
return strcmp(a,b);
|
302
|
+
} // between
|
303
|
+
inline static bool equal(const char (&a)[N],const char (&b)[M])
|
304
|
+
{
|
305
|
+
return between(a,b) == 0;
|
306
|
+
} // equal
|
307
|
+
inline static bool notEqual(const char (&a)[N],const char (&b)[M])
|
308
|
+
{
|
309
|
+
return between(a,b) != 0;
|
310
|
+
} // notEqual
|
311
|
+
inline static bool less(const char (&a)[N],const char (&b)[M])
|
312
|
+
{
|
313
|
+
return between(a,b) < 0;
|
314
|
+
} // less
|
315
|
+
inline static bool more(const char (&a)[N],const char (&b)[M])
|
316
|
+
{
|
317
|
+
return between(a,b) > 0;
|
318
|
+
} // more
|
319
|
+
inline static bool lessOrEqual(const char (&a)[N],const char (&b)[M])
|
320
|
+
{
|
321
|
+
return between(a,b) <= 0;
|
322
|
+
} // lessOrEqual
|
323
|
+
inline static bool moreOrEqual(const char (&a)[N],const char (&b)[M])
|
324
|
+
{
|
325
|
+
return between(a,b) >= 0;
|
326
|
+
} // moreOrEqual
|
327
|
+
};
|
328
|
+
template <typename A, typename B> int compareBetween(const A &a, const B &b) { return Compare<A,B>::between(a,b); }
|
329
|
+
template <typename A, typename B> bool compareEqual(const A &a, const B &b) { return Compare<A,B>::equal(a,b); }
|
330
|
+
template <typename A, typename B> bool compareNotEqual(const A &a, const B &b) { return Compare<A,B>::notEqual(a,b); }
|
331
|
+
template <typename A, typename B> bool compareLess(const A &a, const B &b) { return Compare<A,B>::less(a,b); }
|
332
|
+
template <typename A, typename B> bool compareMore(const A &a, const B &b) { return Compare<A,B>::more(a,b); }
|
333
|
+
template <typename A, typename B> bool compareLessOrEqual(const A &a, const B &b) { return Compare<A,B>::lessOrEqual(a,b); }
|
334
|
+
template <typename A, typename B> bool compareMoreOrEqual(const A &a, const B &b) { return Compare<A,B>::moreOrEqual(a,b); }
|
data/lib/arduino_ci/version.rb
CHANGED
data/misc/default.yaml
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
packages:
|
2
|
+
esp8266:esp8266:
|
3
|
+
url: http://arduino.esp8266.com/stable/package_esp8266com_index.json
|
4
|
+
adafruit:avr:
|
5
|
+
url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
|
6
|
+
|
7
|
+
platforms:
|
8
|
+
uno:
|
9
|
+
board: arduino:avr:uno
|
10
|
+
package: ~
|
11
|
+
gcc:
|
12
|
+
features:
|
13
|
+
defines:
|
14
|
+
warnings:
|
15
|
+
flags:
|
16
|
+
due:
|
17
|
+
board: arduino:sam:arduino_due_x
|
18
|
+
package: arduino:sam
|
19
|
+
gcc:
|
20
|
+
features:
|
21
|
+
defines:
|
22
|
+
warnings:
|
23
|
+
flags:
|
24
|
+
zero:
|
25
|
+
board: arduino:samd:zero
|
26
|
+
package: arduino:samd
|
27
|
+
gcc:
|
28
|
+
features:
|
29
|
+
defines:
|
30
|
+
warnings:
|
31
|
+
flags:
|
32
|
+
esp8266:
|
33
|
+
board: esp8266:esp8266:huzzah
|
34
|
+
package: esp8266:esp8266
|
35
|
+
gcc:
|
36
|
+
features:
|
37
|
+
defines:
|
38
|
+
warnings:
|
39
|
+
flags:
|
40
|
+
leonardo:
|
41
|
+
board: arduino:avr:leonardo
|
42
|
+
package: ~
|
43
|
+
gcc:
|
44
|
+
features:
|
45
|
+
defines:
|
46
|
+
warnings:
|
47
|
+
flags:
|
48
|
+
trinket:
|
49
|
+
board: adafruit:avr:trinket5
|
50
|
+
package: adafruit:avr
|
51
|
+
gcc:
|
52
|
+
features:
|
53
|
+
defines:
|
54
|
+
warnings:
|
55
|
+
flags:
|
56
|
+
gemma:
|
57
|
+
board: arduino:avr:gemma
|
58
|
+
package: adafruit:avr
|
59
|
+
gcc:
|
60
|
+
features:
|
61
|
+
defines:
|
62
|
+
warnings:
|
63
|
+
flags:
|
64
|
+
|
65
|
+
compile:
|
66
|
+
libraries: ~
|
67
|
+
platforms:
|
68
|
+
- uno
|
69
|
+
- due
|
70
|
+
- leonardo
|
71
|
+
|
72
|
+
unittest:
|
73
|
+
libraries: ~
|
74
|
+
platforms:
|
75
|
+
- uno
|
76
|
+
- due
|
77
|
+
- leonardo
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arduino_ci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Katz
|
@@ -90,6 +90,13 @@ extra_rdoc_files: []
|
|
90
90
|
files:
|
91
91
|
- ".yardopts"
|
92
92
|
- README.md
|
93
|
+
- cpp/arduino/Arduino.cpp
|
94
|
+
- cpp/arduino/Arduino.h
|
95
|
+
- cpp/arduino/AvrMath.h
|
96
|
+
- cpp/unittest/ArduinoUnitTests.cpp
|
97
|
+
- cpp/unittest/ArduinoUnitTests.h
|
98
|
+
- cpp/unittest/Assertion.h
|
99
|
+
- cpp/unittest/Compare.h
|
93
100
|
- exe/arduino_ci_remote.rb
|
94
101
|
- lib/arduino_ci.rb
|
95
102
|
- lib/arduino_ci/arduino_cmd.rb
|
@@ -102,6 +109,7 @@ files:
|
|
102
109
|
- lib/arduino_ci/display_manager.rb
|
103
110
|
- lib/arduino_ci/host.rb
|
104
111
|
- lib/arduino_ci/version.rb
|
112
|
+
- misc/default.yaml
|
105
113
|
homepage: http://github.com/ifreecarve/arduino_ci
|
106
114
|
licenses:
|
107
115
|
- Apache-2.0
|