arduino_ci 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (306) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +203 -4
  3. data/cpp/arduino/Arduino.cpp +0 -21
  4. data/cpp/arduino/Arduino.h +0 -10
  5. data/cpp/arduino/ArduinoDefines.h +0 -1
  6. data/cpp/arduino/AvrMath.h +5 -6
  7. data/cpp/arduino/Godmode.cpp +26 -0
  8. data/cpp/arduino/Godmode.h +41 -19
  9. data/cpp/arduino/HardwareSerial.h +7 -3
  10. data/cpp/arduino/PinHistory.h +160 -0
  11. data/cpp/arduino/Print.h +4 -2
  12. data/cpp/arduino/SoftwareSerial.h +77 -0
  13. data/cpp/arduino/Stream.h +4 -1
  14. data/cpp/arduino/WString.h +15 -9
  15. data/cpp/arduino/{include → avr}/README.md +0 -0
  16. data/cpp/arduino/{include → avr}/common.h +0 -0
  17. data/cpp/arduino/{include → avr}/fuse.h +0 -0
  18. data/cpp/arduino/{include → avr}/io.h +0 -0
  19. data/cpp/arduino/{include → avr}/io1200.h +0 -0
  20. data/cpp/arduino/{include → avr}/io2313.h +0 -0
  21. data/cpp/arduino/{include → avr}/io2323.h +0 -0
  22. data/cpp/arduino/{include → avr}/io2333.h +0 -0
  23. data/cpp/arduino/{include → avr}/io2343.h +0 -0
  24. data/cpp/arduino/{include → avr}/io43u32x.h +0 -0
  25. data/cpp/arduino/{include → avr}/io43u35x.h +0 -0
  26. data/cpp/arduino/{include → avr}/io4414.h +0 -0
  27. data/cpp/arduino/{include → avr}/io4433.h +0 -0
  28. data/cpp/arduino/{include → avr}/io4434.h +0 -0
  29. data/cpp/arduino/{include → avr}/io76c711.h +0 -0
  30. data/cpp/arduino/{include → avr}/io8515.h +0 -0
  31. data/cpp/arduino/{include → avr}/io8534.h +0 -0
  32. data/cpp/arduino/{include → avr}/io8535.h +0 -0
  33. data/cpp/arduino/{include → avr}/io86r401.h +0 -0
  34. data/cpp/arduino/{include → avr}/io90pwm1.h +0 -0
  35. data/cpp/arduino/{include → avr}/io90pwm161.h +0 -0
  36. data/cpp/arduino/{include → avr}/io90pwm216.h +0 -0
  37. data/cpp/arduino/{include → avr}/io90pwm2b.h +0 -0
  38. data/cpp/arduino/{include → avr}/io90pwm316.h +0 -0
  39. data/cpp/arduino/{include → avr}/io90pwm3b.h +0 -0
  40. data/cpp/arduino/{include → avr}/io90pwm81.h +0 -0
  41. data/cpp/arduino/{include → avr}/io90pwmx.h +0 -0
  42. data/cpp/arduino/{include → avr}/io90scr100.h +0 -0
  43. data/cpp/arduino/{include → avr}/ioa5272.h +0 -0
  44. data/cpp/arduino/{include → avr}/ioa5505.h +0 -0
  45. data/cpp/arduino/{include → avr}/ioa5702m322.h +0 -0
  46. data/cpp/arduino/{include → avr}/ioa5782.h +0 -0
  47. data/cpp/arduino/{include → avr}/ioa5790.h +0 -0
  48. data/cpp/arduino/{include → avr}/ioa5790n.h +0 -0
  49. data/cpp/arduino/{include → avr}/ioa5791.h +0 -0
  50. data/cpp/arduino/{include → avr}/ioa5795.h +0 -0
  51. data/cpp/arduino/{include → avr}/ioa5831.h +0 -0
  52. data/cpp/arduino/{include → avr}/ioa6285.h +0 -0
  53. data/cpp/arduino/{include → avr}/ioa6286.h +0 -0
  54. data/cpp/arduino/{include → avr}/ioa6289.h +0 -0
  55. data/cpp/arduino/{include → avr}/ioa6612c.h +0 -0
  56. data/cpp/arduino/{include → avr}/ioa6613c.h +0 -0
  57. data/cpp/arduino/{include → avr}/ioa6614q.h +0 -0
  58. data/cpp/arduino/{include → avr}/ioa6616c.h +0 -0
  59. data/cpp/arduino/{include → avr}/ioa6617c.h +0 -0
  60. data/cpp/arduino/{include → avr}/ioa664251.h +0 -0
  61. data/cpp/arduino/{include → avr}/ioa8210.h +0 -0
  62. data/cpp/arduino/{include → avr}/ioa8510.h +0 -0
  63. data/cpp/arduino/{include → avr}/ioat94k.h +0 -0
  64. data/cpp/arduino/{include → avr}/iocan128.h +0 -0
  65. data/cpp/arduino/{include → avr}/iocan32.h +0 -0
  66. data/cpp/arduino/{include → avr}/iocan64.h +0 -0
  67. data/cpp/arduino/{include → avr}/iocanxx.h +0 -0
  68. data/cpp/arduino/{include → avr}/iom103.h +0 -0
  69. data/cpp/arduino/{include → avr}/iom128.h +0 -0
  70. data/cpp/arduino/{include → avr}/iom1280.h +0 -0
  71. data/cpp/arduino/{include → avr}/iom1281.h +0 -0
  72. data/cpp/arduino/{include → avr}/iom1284.h +0 -0
  73. data/cpp/arduino/{include → avr}/iom1284p.h +0 -0
  74. data/cpp/arduino/{include → avr}/iom1284rfr2.h +0 -0
  75. data/cpp/arduino/{include → avr}/iom128a.h +0 -0
  76. data/cpp/arduino/{include → avr}/iom128rfa1.h +0 -0
  77. data/cpp/arduino/{include → avr}/iom128rfr2.h +0 -0
  78. data/cpp/arduino/{include → avr}/iom16.h +0 -0
  79. data/cpp/arduino/{include → avr}/iom161.h +0 -0
  80. data/cpp/arduino/{include → avr}/iom162.h +0 -0
  81. data/cpp/arduino/{include → avr}/iom163.h +0 -0
  82. data/cpp/arduino/{include → avr}/iom164.h +0 -0
  83. data/cpp/arduino/{include → avr}/iom164a.h +0 -0
  84. data/cpp/arduino/{include → avr}/iom164p.h +0 -0
  85. data/cpp/arduino/{include → avr}/iom164pa.h +0 -0
  86. data/cpp/arduino/{include → avr}/iom165.h +0 -0
  87. data/cpp/arduino/{include → avr}/iom165a.h +0 -0
  88. data/cpp/arduino/{include → avr}/iom165p.h +0 -0
  89. data/cpp/arduino/{include → avr}/iom165pa.h +0 -0
  90. data/cpp/arduino/{include → avr}/iom168.h +0 -0
  91. data/cpp/arduino/{include → avr}/iom168a.h +0 -0
  92. data/cpp/arduino/{include → avr}/iom168p.h +0 -0
  93. data/cpp/arduino/{include → avr}/iom168pa.h +0 -0
  94. data/cpp/arduino/{include → avr}/iom168pb.h +0 -0
  95. data/cpp/arduino/{include → avr}/iom169.h +0 -0
  96. data/cpp/arduino/{include → avr}/iom169a.h +0 -0
  97. data/cpp/arduino/{include → avr}/iom169p.h +0 -0
  98. data/cpp/arduino/{include → avr}/iom169pa.h +0 -0
  99. data/cpp/arduino/{include → avr}/iom16a.h +0 -0
  100. data/cpp/arduino/{include → avr}/iom16hva.h +0 -0
  101. data/cpp/arduino/{include → avr}/iom16hva2.h +0 -0
  102. data/cpp/arduino/{include → avr}/iom16hvb.h +0 -0
  103. data/cpp/arduino/{include → avr}/iom16hvbrevb.h +0 -0
  104. data/cpp/arduino/{include → avr}/iom16m1.h +0 -0
  105. data/cpp/arduino/{include → avr}/iom16u2.h +0 -0
  106. data/cpp/arduino/{include → avr}/iom16u4.h +0 -0
  107. data/cpp/arduino/{include → avr}/iom2560.h +0 -0
  108. data/cpp/arduino/{include → avr}/iom2561.h +0 -0
  109. data/cpp/arduino/{include → avr}/iom2564rfr2.h +0 -0
  110. data/cpp/arduino/{include → avr}/iom256rfr2.h +0 -0
  111. data/cpp/arduino/{include → avr}/iom3000.h +0 -0
  112. data/cpp/arduino/{include → avr}/iom32.h +0 -0
  113. data/cpp/arduino/{include → avr}/iom323.h +0 -0
  114. data/cpp/arduino/{include → avr}/iom324a.h +0 -0
  115. data/cpp/arduino/{include → avr}/iom324p.h +0 -0
  116. data/cpp/arduino/{include → avr}/iom324pa.h +0 -0
  117. data/cpp/arduino/{include → avr}/iom325.h +0 -0
  118. data/cpp/arduino/{include → avr}/iom3250.h +0 -0
  119. data/cpp/arduino/{include → avr}/iom3250a.h +0 -0
  120. data/cpp/arduino/{include → avr}/iom3250p.h +0 -0
  121. data/cpp/arduino/{include → avr}/iom3250pa.h +0 -0
  122. data/cpp/arduino/{include → avr}/iom325a.h +0 -0
  123. data/cpp/arduino/{include → avr}/iom325p.h +0 -0
  124. data/cpp/arduino/{include → avr}/iom325pa.h +0 -0
  125. data/cpp/arduino/{include → avr}/iom328.h +0 -0
  126. data/cpp/arduino/{include → avr}/iom328p.h +0 -0
  127. data/cpp/arduino/{include → avr}/iom329.h +0 -0
  128. data/cpp/arduino/{include → avr}/iom3290.h +0 -0
  129. data/cpp/arduino/{include → avr}/iom3290a.h +0 -0
  130. data/cpp/arduino/{include → avr}/iom3290pa.h +0 -0
  131. data/cpp/arduino/{include → avr}/iom329a.h +0 -0
  132. data/cpp/arduino/{include → avr}/iom329p.h +0 -0
  133. data/cpp/arduino/{include → avr}/iom329pa.h +0 -0
  134. data/cpp/arduino/{include → avr}/iom32a.h +0 -0
  135. data/cpp/arduino/{include → avr}/iom32c1.h +0 -0
  136. data/cpp/arduino/{include → avr}/iom32hvb.h +0 -0
  137. data/cpp/arduino/{include → avr}/iom32hvbrevb.h +0 -0
  138. data/cpp/arduino/{include → avr}/iom32m1.h +0 -0
  139. data/cpp/arduino/{include → avr}/iom32u2.h +0 -0
  140. data/cpp/arduino/{include → avr}/iom32u4.h +0 -0
  141. data/cpp/arduino/{include → avr}/iom32u6.h +0 -0
  142. data/cpp/arduino/{include → avr}/iom406.h +0 -0
  143. data/cpp/arduino/{include → avr}/iom48.h +0 -0
  144. data/cpp/arduino/{include → avr}/iom48a.h +0 -0
  145. data/cpp/arduino/{include → avr}/iom48p.h +0 -0
  146. data/cpp/arduino/{include → avr}/iom48pa.h +0 -0
  147. data/cpp/arduino/{include → avr}/iom48pb.h +0 -0
  148. data/cpp/arduino/{include → avr}/iom64.h +0 -0
  149. data/cpp/arduino/{include → avr}/iom640.h +0 -0
  150. data/cpp/arduino/{include → avr}/iom644.h +0 -0
  151. data/cpp/arduino/{include → avr}/iom644a.h +0 -0
  152. data/cpp/arduino/{include → avr}/iom644p.h +0 -0
  153. data/cpp/arduino/{include → avr}/iom644pa.h +0 -0
  154. data/cpp/arduino/{include → avr}/iom644rfr2.h +0 -0
  155. data/cpp/arduino/{include → avr}/iom645.h +0 -0
  156. data/cpp/arduino/{include → avr}/iom6450.h +0 -0
  157. data/cpp/arduino/{include → avr}/iom6450a.h +0 -0
  158. data/cpp/arduino/{include → avr}/iom6450p.h +0 -0
  159. data/cpp/arduino/{include → avr}/iom645a.h +0 -0
  160. data/cpp/arduino/{include → avr}/iom645p.h +0 -0
  161. data/cpp/arduino/{include → avr}/iom649.h +0 -0
  162. data/cpp/arduino/{include → avr}/iom6490.h +0 -0
  163. data/cpp/arduino/{include → avr}/iom6490a.h +0 -0
  164. data/cpp/arduino/{include → avr}/iom6490p.h +0 -0
  165. data/cpp/arduino/{include → avr}/iom649a.h +0 -0
  166. data/cpp/arduino/{include → avr}/iom649p.h +0 -0
  167. data/cpp/arduino/{include → avr}/iom64a.h +0 -0
  168. data/cpp/arduino/{include → avr}/iom64c1.h +0 -0
  169. data/cpp/arduino/{include → avr}/iom64hve.h +0 -0
  170. data/cpp/arduino/{include → avr}/iom64hve2.h +0 -0
  171. data/cpp/arduino/{include → avr}/iom64m1.h +0 -0
  172. data/cpp/arduino/{include → avr}/iom64rfr2.h +0 -0
  173. data/cpp/arduino/{include → avr}/iom8.h +0 -0
  174. data/cpp/arduino/{include → avr}/iom8515.h +0 -0
  175. data/cpp/arduino/{include → avr}/iom8535.h +0 -0
  176. data/cpp/arduino/{include → avr}/iom88.h +0 -0
  177. data/cpp/arduino/{include → avr}/iom88a.h +0 -0
  178. data/cpp/arduino/{include → avr}/iom88p.h +0 -0
  179. data/cpp/arduino/{include → avr}/iom88pa.h +0 -0
  180. data/cpp/arduino/{include → avr}/iom88pb.h +0 -0
  181. data/cpp/arduino/{include → avr}/iom8a.h +0 -0
  182. data/cpp/arduino/{include → avr}/iom8hva.h +0 -0
  183. data/cpp/arduino/{include → avr}/iom8u2.h +0 -0
  184. data/cpp/arduino/{include → avr}/iomx8.h +0 -0
  185. data/cpp/arduino/{include → avr}/iomxx0_1.h +0 -0
  186. data/cpp/arduino/{include → avr}/iomxx4.h +0 -0
  187. data/cpp/arduino/{include → avr}/iomxxhva.h +0 -0
  188. data/cpp/arduino/{include → avr}/iotn10.h +0 -0
  189. data/cpp/arduino/{include → avr}/iotn11.h +0 -0
  190. data/cpp/arduino/{include → avr}/iotn12.h +0 -0
  191. data/cpp/arduino/{include → avr}/iotn13.h +0 -0
  192. data/cpp/arduino/{include → avr}/iotn13a.h +0 -0
  193. data/cpp/arduino/{include → avr}/iotn15.h +0 -0
  194. data/cpp/arduino/{include → avr}/iotn1634.h +0 -0
  195. data/cpp/arduino/{include → avr}/iotn167.h +0 -0
  196. data/cpp/arduino/{include → avr}/iotn20.h +0 -0
  197. data/cpp/arduino/{include → avr}/iotn22.h +0 -0
  198. data/cpp/arduino/{include → avr}/iotn2313.h +0 -0
  199. data/cpp/arduino/{include → avr}/iotn2313a.h +0 -0
  200. data/cpp/arduino/{include → avr}/iotn24.h +0 -0
  201. data/cpp/arduino/{include → avr}/iotn24a.h +0 -0
  202. data/cpp/arduino/{include → avr}/iotn25.h +0 -0
  203. data/cpp/arduino/{include → avr}/iotn26.h +0 -0
  204. data/cpp/arduino/{include → avr}/iotn261.h +0 -0
  205. data/cpp/arduino/{include → avr}/iotn261a.h +0 -0
  206. data/cpp/arduino/{include → avr}/iotn28.h +0 -0
  207. data/cpp/arduino/{include → avr}/iotn4.h +0 -0
  208. data/cpp/arduino/{include → avr}/iotn40.h +0 -0
  209. data/cpp/arduino/{include → avr}/iotn4313.h +0 -0
  210. data/cpp/arduino/{include → avr}/iotn43u.h +0 -0
  211. data/cpp/arduino/{include → avr}/iotn44.h +0 -0
  212. data/cpp/arduino/{include → avr}/iotn441.h +0 -0
  213. data/cpp/arduino/{include → avr}/iotn44a.h +0 -0
  214. data/cpp/arduino/{include → avr}/iotn45.h +0 -0
  215. data/cpp/arduino/{include → avr}/iotn461.h +0 -0
  216. data/cpp/arduino/{include → avr}/iotn461a.h +0 -0
  217. data/cpp/arduino/{include → avr}/iotn48.h +0 -0
  218. data/cpp/arduino/{include → avr}/iotn5.h +0 -0
  219. data/cpp/arduino/{include → avr}/iotn828.h +0 -0
  220. data/cpp/arduino/{include → avr}/iotn84.h +0 -0
  221. data/cpp/arduino/{include → avr}/iotn841.h +0 -0
  222. data/cpp/arduino/{include → avr}/iotn84a.h +0 -0
  223. data/cpp/arduino/{include → avr}/iotn85.h +0 -0
  224. data/cpp/arduino/{include → avr}/iotn861.h +0 -0
  225. data/cpp/arduino/{include → avr}/iotn861a.h +0 -0
  226. data/cpp/arduino/{include → avr}/iotn87.h +0 -0
  227. data/cpp/arduino/{include → avr}/iotn88.h +0 -0
  228. data/cpp/arduino/{include → avr}/iotn9.h +0 -0
  229. data/cpp/arduino/{include → avr}/iotnx4.h +0 -0
  230. data/cpp/arduino/{include → avr}/iotnx5.h +0 -0
  231. data/cpp/arduino/{include → avr}/iotnx61.h +0 -0
  232. data/cpp/arduino/{include → avr}/iousb1286.h +0 -0
  233. data/cpp/arduino/{include → avr}/iousb1287.h +0 -0
  234. data/cpp/arduino/{include → avr}/iousb162.h +0 -0
  235. data/cpp/arduino/{include → avr}/iousb646.h +0 -0
  236. data/cpp/arduino/{include → avr}/iousb647.h +0 -0
  237. data/cpp/arduino/{include → avr}/iousb82.h +0 -0
  238. data/cpp/arduino/{include → avr}/iousbxx2.h +0 -0
  239. data/cpp/arduino/{include → avr}/iousbxx6_7.h +0 -0
  240. data/cpp/arduino/{include → avr}/iox128a1.h +0 -0
  241. data/cpp/arduino/{include → avr}/iox128a1u.h +0 -0
  242. data/cpp/arduino/{include → avr}/iox128a3.h +0 -0
  243. data/cpp/arduino/{include → avr}/iox128a3u.h +0 -0
  244. data/cpp/arduino/{include → avr}/iox128a4u.h +0 -0
  245. data/cpp/arduino/{include → avr}/iox128b1.h +0 -0
  246. data/cpp/arduino/{include → avr}/iox128b3.h +0 -0
  247. data/cpp/arduino/{include → avr}/iox128c3.h +0 -0
  248. data/cpp/arduino/{include → avr}/iox128d3.h +0 -0
  249. data/cpp/arduino/{include → avr}/iox128d4.h +0 -0
  250. data/cpp/arduino/{include → avr}/iox16a4.h +0 -0
  251. data/cpp/arduino/{include → avr}/iox16a4u.h +0 -0
  252. data/cpp/arduino/{include → avr}/iox16c4.h +0 -0
  253. data/cpp/arduino/{include → avr}/iox16d4.h +0 -0
  254. data/cpp/arduino/{include → avr}/iox16e5.h +0 -0
  255. data/cpp/arduino/{include → avr}/iox192a3.h +0 -0
  256. data/cpp/arduino/{include → avr}/iox192a3u.h +0 -0
  257. data/cpp/arduino/{include → avr}/iox192c3.h +0 -0
  258. data/cpp/arduino/{include → avr}/iox192d3.h +0 -0
  259. data/cpp/arduino/{include → avr}/iox256a3.h +0 -0
  260. data/cpp/arduino/{include → avr}/iox256a3b.h +0 -0
  261. data/cpp/arduino/{include → avr}/iox256a3bu.h +0 -0
  262. data/cpp/arduino/{include → avr}/iox256a3u.h +0 -0
  263. data/cpp/arduino/{include → avr}/iox256c3.h +0 -0
  264. data/cpp/arduino/{include → avr}/iox256d3.h +0 -0
  265. data/cpp/arduino/{include → avr}/iox32a4.h +0 -0
  266. data/cpp/arduino/{include → avr}/iox32a4u.h +0 -0
  267. data/cpp/arduino/{include → avr}/iox32c3.h +0 -0
  268. data/cpp/arduino/{include → avr}/iox32c4.h +0 -0
  269. data/cpp/arduino/{include → avr}/iox32d3.h +0 -0
  270. data/cpp/arduino/{include → avr}/iox32d4.h +0 -0
  271. data/cpp/arduino/{include → avr}/iox32e5.h +0 -0
  272. data/cpp/arduino/{include → avr}/iox384c3.h +0 -0
  273. data/cpp/arduino/{include → avr}/iox384d3.h +0 -0
  274. data/cpp/arduino/{include → avr}/iox64a1.h +0 -0
  275. data/cpp/arduino/{include → avr}/iox64a1u.h +0 -0
  276. data/cpp/arduino/{include → avr}/iox64a3.h +0 -0
  277. data/cpp/arduino/{include → avr}/iox64a3u.h +0 -0
  278. data/cpp/arduino/{include → avr}/iox64a4u.h +0 -0
  279. data/cpp/arduino/{include → avr}/iox64b1.h +0 -0
  280. data/cpp/arduino/{include → avr}/iox64b3.h +0 -0
  281. data/cpp/arduino/{include → avr}/iox64c3.h +0 -0
  282. data/cpp/arduino/{include → avr}/iox64d3.h +0 -0
  283. data/cpp/arduino/{include → avr}/iox64d4.h +0 -0
  284. data/cpp/arduino/{include → avr}/iox8e5.h +0 -0
  285. data/cpp/arduino/{include → avr}/lock.h +0 -0
  286. data/cpp/arduino/avr/pgmspace.h +94 -0
  287. data/cpp/arduino/{include → avr}/portpins.h +0 -0
  288. data/cpp/arduino/{include → avr}/version.h +0 -0
  289. data/cpp/arduino/{include → avr}/xmega.h +0 -0
  290. data/cpp/arduino/binary.h +1 -0
  291. data/cpp/arduino/ci/DeviceUsingBytes.h +56 -0
  292. data/cpp/arduino/ci/ObservableDataStream.h +124 -0
  293. data/cpp/arduino/ci/Queue.h +73 -0
  294. data/cpp/arduino/ci/README.md +5 -0
  295. data/cpp/arduino/ci/Table.h +125 -0
  296. data/cpp/unittest/ArduinoUnitTests.h +16 -16
  297. data/cpp/unittest/Assertion.h +2 -2
  298. data/cpp/unittest/Compare.h +1 -1
  299. data/exe/arduino_ci_remote.rb +34 -21
  300. data/lib/arduino_ci/arduino_cmd.rb +1 -0
  301. data/lib/arduino_ci/arduino_installation.rb +13 -19
  302. data/lib/arduino_ci/ci_config.rb +42 -10
  303. data/lib/arduino_ci/cpp_library.rb +6 -1
  304. data/lib/arduino_ci/version.rb +1 -1
  305. data/misc/{default.yaml → default.yml} +0 -0
  306. metadata +285 -277
@@ -0,0 +1,5 @@
1
+ The parent directory is for files that must stand in for their Arduino counterparts -- any `SomeFile` that might be requested as `#include <SomeFile.h>`.
2
+
3
+ This directory is specificially for support files required by those other files. That's because we don't want to create collisions on filenames for common data structures like Queue.
4
+
5
+ If there end up being class-level conflicts, it is this developer's stated intention to rename our classes such that `class Float` becomes `class FloatyMcFloatFace`.
@@ -0,0 +1,125 @@
1
+ #pragma once
2
+
3
+ // A template-ized lookup table implementation
4
+ //
5
+ // this is this stupidest table implementation ever but it's
6
+ // an MVP for unit testing. O(n).
7
+ template <typename K, typename V>
8
+ class Table {
9
+ private:
10
+ struct Node {
11
+ K key;
12
+ V val;
13
+ Node *next;
14
+ };
15
+
16
+ Node* mStart;
17
+ unsigned long mSize;
18
+ // to alow const reference signatures, pre-allocate nil values
19
+ K mNilK;
20
+ V mNilV;
21
+
22
+ void init() {
23
+ mStart = NULL;
24
+ mSize = 0;
25
+ }
26
+
27
+ public:
28
+ Table() : mNilK(), mNilV() { init(); }
29
+
30
+ // number of things in the table
31
+ inline unsigned long size() const { return mSize; }
32
+
33
+ // whether there are no things
34
+ inline bool empty() const { return 0 == mSize; }
35
+
36
+ // whether there is a thing stored at the given key
37
+ bool has(K const key) const {
38
+ for (Node* p = mStart; p; p = p->next) {
39
+ if (p->key == key) return true;
40
+ }
41
+ return false;
42
+ }
43
+
44
+ // allow find operations on keys
45
+ template <typename T>
46
+ const K& getMatchingKey(T const firstArg, bool (*isMatch)(const T, const K)) const {
47
+ for (Node* p = mStart; p; p = p->next) {
48
+ if (isMatch(firstArg, p->key)) return p->key;
49
+ }
50
+ return mNilK;
51
+ }
52
+
53
+ // allow iteration over entire table, with a work function that takes key/value pairs
54
+ void iterate(void (*work)(const K&, const V&)) const {
55
+ for (Node* p = mStart; p; p = p->next) work(p->key, p->val);
56
+ }
57
+ void iterate(void (*work)(K, V)) const {
58
+ for (Node* p = mStart; p; p = p->next) work(p->key, p->val);
59
+ }
60
+
61
+ // allow iteration over entire table, with a work function that takes key/value pairs
62
+ // plus an initial argument. this enables member function passing (via workaround)
63
+ template <typename T>
64
+ void iterate(void (*work)(T&, const K&, const V&), T& firstArg) const {
65
+ for (Node* p = mStart; p; p = p->next) work(firstArg, p->key, p->val);
66
+ }
67
+
68
+ template <typename T>
69
+ void iterate(void (*work)(T&, K, V), T& firstArg) const {
70
+ for (Node* p = mStart; p; p = p->next) work(firstArg, p->key, p->val);
71
+ }
72
+
73
+ template <typename T>
74
+ void iterate(void (*work)(T, K, V), T firstArg) const {
75
+ for (Node* p = mStart; p; p = p->next) work(firstArg, p->key, p->val);
76
+ }
77
+
78
+ // return the value for a given key
79
+ const V& get(K const key) const {
80
+ for (Node* p = mStart; p; p = p->next) {
81
+ if (p->key == key) return p->val;
82
+ }
83
+ return mNilV;
84
+ }
85
+
86
+ // remove an item by key
87
+ bool remove(K const key) {
88
+ Node *o = NULL;
89
+ for (Node* p = mStart; p; p = p->next) {
90
+ if (p->key == key) {
91
+ (o ? o->next : mStart) = p->next;
92
+ delete p;
93
+ --mSize;
94
+ return true;
95
+ }
96
+ o = p;
97
+ }
98
+ return false;
99
+ }
100
+
101
+ // add a key/value pair. deletes any existing key by that name.
102
+ bool add(K const key, V const val) {
103
+ remove(key);
104
+ Node *n = new Node;
105
+ if (n == NULL) return false;
106
+ n->key = key;
107
+ n->val = val;
108
+ n->next = mStart;
109
+ mStart = n;
110
+ ++mSize;
111
+ return true;
112
+ }
113
+
114
+ // remove everything
115
+ void clear() {
116
+ Node* p;
117
+ while (mStart) {
118
+ p = mStart;
119
+ mStart = mStart->next;
120
+ delete p;
121
+ }
122
+ }
123
+
124
+ ~Table() { clear(); }
125
+ };
@@ -28,23 +28,23 @@ class Test
28
28
  ~ReporterTAP() {}
29
29
 
30
30
  void onTestRunInit(int numTests) {
31
- cout << "TAP version 13" << endl;
32
- cout << 1 << ".." << numTests << endl; // we know how many tests, in advance
31
+ cerr << "TAP version 13" << endl;
32
+ cerr << 1 << ".." << numTests << endl; // we know how many tests, in advance
33
33
  mTestCounter = 0;
34
34
  }
35
35
 
36
36
  void onTestStart(TestData td) {
37
37
  mAssertCounter = 0;
38
38
  ++mTestCounter;
39
- cout << "# Subtest: " << td.name << endl;
39
+ cerr << "# Subtest: " << td.name << endl;
40
40
  }
41
41
 
42
42
  void onTestEnd(TestData td) {
43
- cout << " 1.." << mAssertCounter << endl;
43
+ cerr << " 1.." << mAssertCounter << endl;
44
44
  if (td.result == RESULT_PASS) {
45
- cout << "ok " << mTestCounter << " - " << td.name << endl;
45
+ cerr << "ok " << mTestCounter << " - " << td.name << endl;
46
46
  } else {
47
- cout << "not ok " << mTestCounter << " - " << td.name << endl;
47
+ cerr << "not ok " << mTestCounter << " - " << td.name << endl;
48
48
  }
49
49
  }
50
50
 
@@ -61,17 +61,17 @@ class Test
61
61
  const char* rhsLabel,
62
62
  const B &rhs
63
63
  ) {
64
- cout << " " << (pass ? "" : "not ") << "ok " << ++mAssertCounter << " - ";
65
- cout << description << " " << lhsLabel << " " << opLabel << " " << rhsLabel << endl;
64
+ cerr << " " << (pass ? "" : "not ") << "ok " << ++mAssertCounter << " - ";
65
+ cerr << description << " " << lhsLabel << " " << opLabel << " " << rhsLabel << endl;
66
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;
67
+ cerr << " ---" << endl;
68
+ cerr << " operator: " << opLabel << endl;
69
+ cerr << " " << lhsRelevance << ": " << lhs << endl;
70
+ cerr << " " << rhsRelevance << ": " << rhs << endl;
71
+ cerr << " at:" << endl;
72
+ cerr << " file: " << file << endl;
73
+ cerr << " line: " << line << endl;
74
+ cerr << " ..." << endl;
75
75
  }
76
76
  }
77
77
  };
@@ -46,6 +46,6 @@
46
46
  #define assureMore(arg1,arg2) assureOp("assureMore","upperBound",arg1,compareMore,">","lowerBound",arg2)
47
47
  #define assureLessOrEqual(arg1,arg2) assureOp("assureLessOrEqual","lowerBound",arg1,compareLessOrEqual,"<=","upperBound",arg2)
48
48
  #define assureMoreOrEqual(arg1,arg2) assureOp("assureMoreOrEqual","upperBound",arg1,compareMoreOrEqual,">=","lowerBound",arg2)
49
- #define assureTrue(arg) assertEqual(true, arg)
50
- #define assureFalse(arg) assertEqual(false, arg)
49
+ #define assureTrue(arg) assureEqual(true, arg)
50
+ #define assureFalse(arg) assureEqual(false, arg)
51
51
 
@@ -1,7 +1,6 @@
1
1
  #pragma once
2
2
  #include "string.h"
3
3
 
4
-
5
4
  template < typename A, typename B > struct Compare
6
5
  {
7
6
  inline static int between(const A &a,const B &b)
@@ -418,6 +417,7 @@ template <typename T> struct Compare<T, bool>
418
417
  return between(a,b) >= 0;
419
418
  } // moreOrEqual
420
419
  };
420
+
421
421
  template <typename A, typename B> int compareBetween(const A &a, const B &b) { return Compare<A,B>::between(a,b); }
422
422
  template <typename A, typename B> bool compareEqual(const A &a, const B &b) { return Compare<A,B>::equal(a,b); }
423
423
  template <typename A, typename B> bool compareNotEqual(const A &a, const B &b) { return Compare<A,B>::notEqual(a,b); }
@@ -25,7 +25,7 @@ def perform_action(message, on_fail_msg, abort_on_fail)
25
25
  line = "#{message}..."
26
26
  print line
27
27
  result = yield
28
- mark = result ? "✓" : "X"
28
+ mark = result ? "✓" : ""
29
29
  puts mark.rjust(WIDTH - line.length, " ")
30
30
  unless result
31
31
  puts on_fail_msg unless on_fail_msg.nil?
@@ -88,36 +88,49 @@ aux_libraries.each do |l|
88
88
  assure("Installing aux library '#{l}'") { @arduino_cmd.install_library(l) }
89
89
  end
90
90
 
91
- config.platforms_to_unittest.each do |p|
92
- board = all_platforms[p][:board]
93
- assure("Switching to board for #{p} (#{board})") { @arduino_cmd.use_board(board) }
94
- cpp_library.test_files.each do |unittest_path|
95
- unittest_name = File.basename(unittest_path)
96
- attempt("Unit testing #{unittest_name}") do
97
- exe = cpp_library.build_for_test_with_configuration(
98
- unittest_path,
99
- config.aux_libraries_for_unittest,
100
- config.gcc_config(p)
101
- )
102
- puts
103
- unless exe
104
- puts "Last command: #{cpp_library.last_cmd}"
105
- puts cpp_library.last_out
106
- puts cpp_library.last_err
107
- next false
91
+ # iterate boards / tests
92
+ last_board = nil
93
+ if cpp_library.test_files.empty?
94
+ attempt("Skipping unit tests; no test files were found") { true }
95
+ elsif config.platforms_to_unittest.empty?
96
+ attempt("Skipping unit tests; no platforms were requestsed") { true }
97
+ else
98
+ config.platforms_to_unittest.each do |p|
99
+ board = all_platforms[p][:board]
100
+ # assure("Switching to board for #{p} (#{board})") { @arduino_cmd.use_board(board) } unless last_board == board
101
+ last_board = board
102
+ cpp_library.test_files.each do |unittest_path|
103
+ unittest_name = File.basename(unittest_path)
104
+ attempt("Unit testing #{unittest_name}") do
105
+ exe = cpp_library.build_for_test_with_configuration(
106
+ unittest_path,
107
+ config.aux_libraries_for_unittest,
108
+ config.gcc_config(p)
109
+ )
110
+ puts
111
+ unless exe
112
+ puts "Last command: #{cpp_library.last_cmd}"
113
+ puts cpp_library.last_out
114
+ puts cpp_library.last_err
115
+ next false
116
+ end
117
+ cpp_library.run_test_file(exe)
108
118
  end
109
- cpp_library.run_test_file(exe)
110
119
  end
111
120
  end
112
121
  end
113
122
 
114
- attempt("Setting compiler warning level") { @arduino_cmd.set_pref("compiler.warning_level", "all") }
123
+ unless library_examples.empty?
124
+ attempt("Setting compiler warning level") { @arduino_cmd.set_pref("compiler.warning_level", "all") }
125
+ end
115
126
 
127
+ # unlike previous, iterate examples / boards
116
128
  library_examples.each do |example_path|
117
129
  ovr_config = config.from_example(example_path)
118
130
  ovr_config.platforms_to_build.each do |p|
119
131
  board = all_platforms[p][:board]
120
- assure("Switching to board for #{p} (#{board})") { @arduino_cmd.use_board(board) }
132
+ assure("Switching to board for #{p} (#{board})") { @arduino_cmd.use_board(board) } unless last_board == board
133
+ last_board = board
121
134
  example_name = File.basename(example_path)
122
135
  attempt("Verifying #{example_name}") do
123
136
  ret = @arduino_cmd.verify_sketch(example_path)
@@ -281,6 +281,7 @@ module ArduinoCI
281
281
  # @return [Array<String>] Example sketch files
282
282
  def library_examples(installed_library_path)
283
283
  example_path = File.join(installed_library_path, "examples")
284
+ return [] unless File.exist?(example_path)
284
285
  examples = Pathname.new(example_path).children.select(&:directory?).map(&:to_path).map(&File.method(:basename))
285
286
  files = examples.map do |e|
286
287
  proj_file = File.join(example_path, e, "#{e}.ino")
@@ -29,28 +29,22 @@ module ArduinoCI
29
29
  # @return [ArduinoCI::ArduinoCmdOSX] an instance of a command
30
30
  def autolocate_osx
31
31
  osx_root = "/Applications/Arduino.app/Contents"
32
- old_way = false
33
32
  return nil unless File.exist? osx_root
34
33
 
35
34
  ret = ArduinoCmdOSX.new
36
- osx_place = "#{osx_root}/MacOS"
37
-
38
- if old_way
39
- ret.base_cmd = [File.join(osx_place, "Arduino")]
40
- else
41
- jvm_runtime = `/usr/libexec/java_home`
42
- ret.base_cmd = [
43
- "java",
44
- "-cp", "#{osx_root}/Java/*",
45
- "-DAPP_DIR=#{osx_root}/Java",
46
- "-Djava.ext.dirs=$JVM_RUNTIME/Contents/Home/lib/ext/:#{jvm_runtime}/Contents/Home/jre/lib/ext/",
47
- "-Dfile.encoding=UTF-8",
48
- "-Dapple.awt.UIElement=true",
49
- "-Xms128M",
50
- "-Xmx512M",
51
- "processing.app.Base",
52
- ]
53
- end
35
+
36
+ # old_way
37
+ # ret.base_cmd = [File.join("#{osx_root}/MacOS", "Arduino")]
38
+ ret.base_cmd = [
39
+ "java",
40
+ "-cp", "#{osx_root}/Java/*",
41
+ "-DAPP_DIR=#{osx_root}/Java",
42
+ "-Dfile.encoding=UTF-8",
43
+ "-Dapple.awt.UIElement=true",
44
+ "-Xms128M",
45
+ "-Xmx512M",
46
+ "processing.app.Base",
47
+ ]
54
48
  ret
55
49
  end
56
50
 
@@ -27,12 +27,19 @@ COMPILE_SCHEMA = {
27
27
  UNITTEST_SCHEMA = {
28
28
  platforms: Array,
29
29
  libraries: Array,
30
+ testfiles: {
31
+ select: Array,
32
+ reject: Array,
33
+ }
30
34
  }.freeze
31
35
  module ArduinoCI
32
36
 
33
37
  # The filename controlling (overriding) the defaults for testing.
34
38
  # Files with this name can be used in the root directory of the Arduino library and in any/all of the example directories
35
- CONFIG_FILENAME = ".arduino-ci.yaml".freeze
39
+ CONFIG_FILENAMES = [
40
+ ".arduino-ci.yml",
41
+ ".arduino-ci.yaml",
42
+ ].freeze
36
43
 
37
44
  # Provide the configuration and CI plan
38
45
  # - Read from a base config with default platforms defined
@@ -46,7 +53,7 @@ module ArduinoCI
46
53
  # @return [ArudinoCI::CIConfig] The configuration with defaults filled in
47
54
  def default
48
55
  ret = new
49
- ret.load_yaml(File.expand_path("../../../misc/default.yaml", __FILE__))
56
+ ret.load_yaml(File.expand_path("../../../misc/default.yml", __FILE__))
50
57
  ret
51
58
  end
52
59
  end
@@ -99,6 +106,8 @@ module ArduinoCI
99
106
  # @return [ArduinoCI::CIConfig] a reference to self
100
107
  def load_yaml(path)
101
108
  yml = YAML.load_file(path)
109
+ raise "The YAML file at #{path} failed to load" unless yml
110
+
102
111
  if yml.include?("packages")
103
112
  yml["packages"].each do |k, v|
104
113
  valid_data = validate_data("packages", v, PACKAGE_SCHEMA)
@@ -139,18 +148,26 @@ module ArduinoCI
139
148
  overridden_config
140
149
  end
141
150
 
142
- # Try to override config with a file at a given location (if it exists)
143
- # @param path [String] the path to the settings yaml file
144
- # @return [ArduinoCI::CIConfig] the new settings object
145
- def attempt_override(config_path)
146
- return self unless File.exist? config_path
147
- with_override(config_path)
151
+ # Get the config file at a given path, if it exists, and pass that to a block.
152
+ # Many config files may exist, but only the first match is used
153
+ # @param base_dir [String] The directory in which to search for a config file
154
+ # @param val_when_no_match [Object] The value to return if no config files are found
155
+ # @yield [path] Process the configuration file at the given path
156
+ # @yieldparam [String] The path of an existing config file
157
+ # @yieldreturn [ArduinoCI::CIConfig] a settings object
158
+ # @return [ArduinoCI::CIConfig]
159
+ def with_config(base_dir, val_when_no_match)
160
+ CONFIG_FILENAMES.each do |f|
161
+ path = base_dir.nil? ? f : File.join(base_dir, f)
162
+ return (yield path) if File.exist?(path)
163
+ end
164
+ val_when_no_match
148
165
  end
149
166
 
150
167
  # Produce a configuration, assuming the CI script runs from the working directory of the base project
151
168
  # @return [ArduinoCI::CIConfig] the new settings object
152
169
  def from_project_library
153
- attempt_override(CONFIG_FILENAME)
170
+ with_config(nil, self) { |path| with_override(path) }
154
171
  end
155
172
 
156
173
  # Produce a configuration override taken from an Arduino library example path
@@ -159,7 +176,7 @@ module ArduinoCI
159
176
  # @return [ArduinoCI::CIConfig] the new settings object
160
177
  def from_example(example_path)
161
178
  base_dir = File.directory?(example_path) ? example_path : File.dirname(example_path)
162
- attempt_override(File.join(base_dir, CONFIG_FILENAME))
179
+ with_config(base_dir, self) { |path| with_override(path) }
163
180
  end
164
181
 
165
182
  # get information about a given platform: board name, package name, compiler stuff, etc
@@ -204,6 +221,21 @@ module ArduinoCI
204
221
  @unittest_info[:libraries]
205
222
  end
206
223
 
224
+ # Config allows select / reject (aka whitelist / blacklist) criteria. Enforce on a dir
225
+ # @param paths [Array<String>] the initial set of test files
226
+ # @return [Array<String>] files that match the select/reject criteria
227
+ def allowable_unittest_files(paths)
228
+ return paths if @unittest_info[:testfiles].nil?
229
+ ret = paths
230
+ unless @unittest_info[:testfiles][:select].nil? || @unittest_info[:testfiles][:select].empty?
231
+ ret = ret.select { |p| unittest_info[:testfiles][:select].any? { |glob| File.fnmatch(glob, File.basename(p)) } }
232
+ end
233
+ unless @unittest_info[:testfiles][:reject].nil?
234
+ ret = ret.reject { |p| unittest_info[:testfiles][:reject].any? { |glob| File.fnmatch(glob, File.basename(p)) } }
235
+ end
236
+ ret
237
+ end
238
+
207
239
  # get GCC configuration for a given platform
208
240
  # @param platform_name [String] The name of the platform as defined in yaml
209
241
  # @return [Hash] the settings