PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

595 lines
16KB

  1. #include "unit-tests.h"
  2. #include "unit-tests_Settings.h"
  3. #include <src/MIDI.h>
  4. #include <test/mocks/test-mocks_SerialMock.h>
  5. BEGIN_MIDI_NAMESPACE
  6. END_MIDI_NAMESPACE
  7. // -----------------------------------------------------------------------------
  8. BEGIN_UNNAMED_NAMESPACE
  9. using namespace testing;
  10. USING_NAMESPACE_UNIT_TESTS
  11. template<unsigned Size>
  12. struct VariableSysExSettings : midi::DefaultSettings
  13. {
  14. static const unsigned SysExMaxSize = Size;
  15. };
  16. typedef test_mocks::SerialMock<256> SerialMock;
  17. typedef midi::SerialMIDI<SerialMock> Transport;
  18. typedef VariableSysExSettings<256> Settings;
  19. typedef midi::MidiInterface<Transport, Settings> MidiInterface;
  20. MidiInterface* midi;
  21. class MidiInputCallbacks : public Test
  22. {
  23. public:
  24. MidiInputCallbacks()
  25. : mTransport(mSerial)
  26. , mMidi(mTransport)
  27. {
  28. }
  29. virtual ~MidiInputCallbacks()
  30. {
  31. }
  32. protected:
  33. virtual void SetUp()
  34. {
  35. midi = &mMidi;
  36. }
  37. virtual void TearDown()
  38. {
  39. midi = nullptr;
  40. }
  41. protected:
  42. SerialMock mSerial;
  43. Transport mTransport;
  44. MidiInterface mMidi;
  45. };
  46. // --
  47. void handleNoteOn(byte inChannel, byte inPitch, byte inVelocity)
  48. {
  49. EXPECT_NE(midi, nullptr);
  50. midi->sendNoteOn(inPitch, inVelocity, inChannel);
  51. }
  52. TEST_F(MidiInputCallbacks, noteOn)
  53. {
  54. mMidi.setHandleNoteOn(handleNoteOn);
  55. mMidi.begin(MIDI_CHANNEL_OMNI);
  56. mMidi.turnThruOff();
  57. static const unsigned rxSize = 3;
  58. static const byte rxData[rxSize] = { 0x9b, 12, 34 };
  59. mSerial.mRxBuffer.write(rxData, rxSize);
  60. EXPECT_EQ(mMidi.read(), false);
  61. EXPECT_EQ(mMidi.read(), false);
  62. EXPECT_EQ(mMidi.read(), true);
  63. EXPECT_EQ(mMidi.getType(), midi::NoteOn);
  64. EXPECT_EQ(mMidi.getChannel(), 12);
  65. EXPECT_EQ(mMidi.getData1(), 12);
  66. EXPECT_EQ(mMidi.getData2(), 34);
  67. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 3);
  68. byte buffer[3] = { 0 };
  69. mSerial.mTxBuffer.read(buffer, 3);
  70. EXPECT_THAT(buffer, ContainerEq(rxData));
  71. // Test null velocity note on
  72. EXPECT_EQ(MidiInterface::Settings::HandleNullVelocityNoteOnAsNoteOff, true);
  73. mSerial.mRxBuffer.write(0x9b);
  74. mSerial.mRxBuffer.write(12);
  75. mSerial.mRxBuffer.write(0);
  76. EXPECT_EQ(mMidi.read(), false);
  77. EXPECT_EQ(mMidi.read(), false);
  78. EXPECT_EQ(mMidi.read(), true);
  79. EXPECT_EQ(mMidi.getType(), midi::NoteOff);
  80. EXPECT_EQ(mMidi.getChannel(), 12);
  81. EXPECT_EQ(mMidi.getData1(), 12);
  82. EXPECT_EQ(mMidi.getData2(), 0);
  83. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 0);
  84. }
  85. // --
  86. void handleNoteOff(byte inChannel, byte inPitch, byte inVelocity)
  87. {
  88. EXPECT_NE(midi, nullptr);
  89. midi->sendNoteOff(inPitch, inVelocity, inChannel);
  90. }
  91. TEST_F(MidiInputCallbacks, noteOff)
  92. {
  93. mMidi.setHandleNoteOff(handleNoteOff);
  94. mMidi.begin(MIDI_CHANNEL_OMNI);
  95. mMidi.turnThruOff();
  96. static const unsigned rxSize = 3;
  97. static const byte rxData[rxSize] = { 0x8b, 12, 34 };
  98. mSerial.mRxBuffer.write(rxData, rxSize);
  99. EXPECT_EQ(mMidi.read(), false);
  100. EXPECT_EQ(mMidi.read(), false);
  101. EXPECT_EQ(mMidi.read(), true);
  102. EXPECT_EQ(mMidi.getType(), midi::NoteOff);
  103. EXPECT_EQ(mMidi.getChannel(), 12);
  104. EXPECT_EQ(mMidi.getData1(), 12);
  105. EXPECT_EQ(mMidi.getData2(), 34);
  106. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 3);
  107. byte buffer[3] = { 0 };
  108. mSerial.mTxBuffer.read(buffer, 3);
  109. EXPECT_THAT(buffer, ContainerEq(rxData));
  110. // Test null velocity note on
  111. EXPECT_EQ(MidiInterface::Settings::HandleNullVelocityNoteOnAsNoteOff, true);
  112. mSerial.mRxBuffer.write(0x9b);
  113. mSerial.mRxBuffer.write(12);
  114. mSerial.mRxBuffer.write(0);
  115. EXPECT_EQ(mMidi.read(), false);
  116. EXPECT_EQ(mMidi.read(), false);
  117. EXPECT_EQ(mMidi.read(), true);
  118. EXPECT_EQ(mMidi.getType(), midi::NoteOff);
  119. EXPECT_EQ(mMidi.getChannel(), 12);
  120. EXPECT_EQ(mMidi.getData1(), 12);
  121. EXPECT_EQ(mMidi.getData2(), 0);
  122. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 3);
  123. mSerial.mTxBuffer.read(buffer, 3);
  124. EXPECT_THAT(buffer, ElementsAreArray({
  125. 0x8b, 12, 0
  126. }));
  127. }
  128. // --
  129. void handleAfterTouchPoly(byte inChannel, byte inNote, byte inValue)
  130. {
  131. EXPECT_NE(midi, nullptr);
  132. midi->sendAfterTouch(inNote, inValue, inChannel);
  133. }
  134. TEST_F(MidiInputCallbacks, afterTouchPoly)
  135. {
  136. mMidi.setHandleAfterTouchPoly(handleAfterTouchPoly);
  137. mMidi.begin(MIDI_CHANNEL_OMNI);
  138. mMidi.turnThruOff();
  139. static const unsigned rxSize = 3;
  140. static const byte rxData[rxSize] = { 0xab, 12, 34 };
  141. mSerial.mRxBuffer.write(rxData, rxSize);
  142. EXPECT_EQ(mMidi.read(), false);
  143. EXPECT_EQ(mMidi.read(), false);
  144. EXPECT_EQ(mMidi.read(), true);
  145. EXPECT_EQ(mMidi.getType(), midi::AfterTouchPoly);
  146. EXPECT_EQ(mMidi.getChannel(), 12);
  147. EXPECT_EQ(mMidi.getData1(), 12);
  148. EXPECT_EQ(mMidi.getData2(), 34);
  149. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 3);
  150. byte buffer[3] = { 0 };
  151. mSerial.mTxBuffer.read(buffer, 3);
  152. EXPECT_THAT(buffer, ContainerEq(rxData));
  153. }
  154. // --
  155. void handleControlChange(byte inChannel, byte inNumber, byte inValue)
  156. {
  157. EXPECT_NE(midi, nullptr);
  158. midi->sendControlChange(inNumber, inValue, inChannel);
  159. }
  160. TEST_F(MidiInputCallbacks, controlChange)
  161. {
  162. mMidi.setHandleControlChange(handleControlChange);
  163. mMidi.begin(MIDI_CHANNEL_OMNI);
  164. mMidi.turnThruOff();
  165. static const unsigned rxSize = 3;
  166. static const byte rxData[rxSize] = { 0xbb, 12, 34 };
  167. mSerial.mRxBuffer.write(rxData, rxSize);
  168. EXPECT_EQ(mMidi.read(), false);
  169. EXPECT_EQ(mMidi.read(), false);
  170. EXPECT_EQ(mMidi.read(), true);
  171. EXPECT_EQ(mMidi.getType(), midi::ControlChange);
  172. EXPECT_EQ(mMidi.getChannel(), 12);
  173. EXPECT_EQ(mMidi.getData1(), 12);
  174. EXPECT_EQ(mMidi.getData2(), 34);
  175. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 3);
  176. byte buffer[3] = { 0 };
  177. mSerial.mTxBuffer.read(buffer, 3);
  178. EXPECT_THAT(buffer, ContainerEq(rxData));
  179. }
  180. // --
  181. void handleProgramChange(byte inChannel, byte inNumber)
  182. {
  183. EXPECT_NE(midi, nullptr);
  184. midi->sendProgramChange(inNumber, inChannel);
  185. }
  186. TEST_F(MidiInputCallbacks, programChange)
  187. {
  188. mMidi.setHandleProgramChange(handleProgramChange);
  189. mMidi.begin(MIDI_CHANNEL_OMNI);
  190. mMidi.turnThruOff();
  191. static const unsigned rxSize = 2;
  192. static const byte rxData[rxSize] = { 0xcb, 12 };
  193. mSerial.mRxBuffer.write(rxData, rxSize);
  194. EXPECT_EQ(mMidi.read(), false);
  195. EXPECT_EQ(mMidi.read(), true);
  196. EXPECT_EQ(mMidi.getType(), midi::ProgramChange);
  197. EXPECT_EQ(mMidi.getChannel(), 12);
  198. EXPECT_EQ(mMidi.getData1(), 12);
  199. EXPECT_EQ(mMidi.getData2(), 0);
  200. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 2);
  201. byte buffer[2] = { 0 };
  202. mSerial.mTxBuffer.read(buffer, 2);
  203. EXPECT_THAT(buffer, ContainerEq(rxData));
  204. }
  205. // --
  206. void handleAfterTouchChannel(byte inChannel, byte inPressure)
  207. {
  208. EXPECT_NE(midi, nullptr);
  209. midi->sendAfterTouch(inPressure, inChannel);
  210. }
  211. TEST_F(MidiInputCallbacks, afterTouchChannel)
  212. {
  213. mMidi.setHandleAfterTouchChannel(handleAfterTouchChannel);
  214. mMidi.begin(MIDI_CHANNEL_OMNI);
  215. mMidi.turnThruOff();
  216. static const unsigned rxSize = 2;
  217. static const byte rxData[rxSize] = { 0xdb, 12 };
  218. mSerial.mRxBuffer.write(rxData, rxSize);
  219. EXPECT_EQ(mMidi.read(), false);
  220. EXPECT_EQ(mMidi.read(), true);
  221. EXPECT_EQ(mMidi.getType(), midi::AfterTouchChannel);
  222. EXPECT_EQ(mMidi.getChannel(), 12);
  223. EXPECT_EQ(mMidi.getData1(), 12);
  224. EXPECT_EQ(mMidi.getData2(), 0);
  225. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 2);
  226. byte buffer[2] = { 0 };
  227. mSerial.mTxBuffer.read(buffer, 2);
  228. EXPECT_THAT(buffer, ContainerEq(rxData));
  229. }
  230. // --
  231. void handlePitchBend(byte inChannel, int inValue)
  232. {
  233. EXPECT_NE(midi, nullptr);
  234. midi->sendPitchBend(inValue, inChannel);
  235. }
  236. TEST_F(MidiInputCallbacks, pitchBend)
  237. {
  238. mMidi.setHandlePitchBend(handlePitchBend);
  239. mMidi.begin(MIDI_CHANNEL_OMNI);
  240. mMidi.turnThruOff();
  241. static const unsigned rxSize = 3;
  242. static const byte rxData[rxSize] = { 0xeb, 12, 34 };
  243. mSerial.mRxBuffer.write(rxData, rxSize);
  244. EXPECT_EQ(mMidi.read(), false);
  245. EXPECT_EQ(mMidi.read(), false);
  246. EXPECT_EQ(mMidi.read(), true);
  247. EXPECT_EQ(mMidi.getType(), midi::PitchBend);
  248. EXPECT_EQ(mMidi.getChannel(), 12);
  249. EXPECT_EQ(mMidi.getData1(), 12);
  250. EXPECT_EQ(mMidi.getData2(), 34);
  251. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 3);
  252. byte buffer[3] = { 0 };
  253. mSerial.mTxBuffer.read(buffer, 3);
  254. EXPECT_THAT(buffer, ContainerEq(rxData));
  255. }
  256. // --
  257. void handleSysEx(byte* inData, unsigned inSize)
  258. {
  259. EXPECT_NE(midi, nullptr);
  260. midi->sendSysEx(inSize, inData, true);
  261. }
  262. TEST_F(MidiInputCallbacks, sysEx)
  263. {
  264. mMidi.setHandleSystemExclusive(handleSysEx);
  265. mMidi.begin(MIDI_CHANNEL_OMNI);
  266. mMidi.turnThruOff();
  267. static const unsigned rxSize = 15;
  268. static const byte rxData[rxSize] = {
  269. 0xf0, 'H','e','l','l','o',',',' ','W','o','r','l','d','!', 0xf7
  270. };
  271. mSerial.mRxBuffer.write(rxData, rxSize);
  272. for (unsigned i = 0; i < rxSize - 1; ++i)
  273. {
  274. EXPECT_EQ(mMidi.read(), false);
  275. }
  276. EXPECT_EQ(mMidi.read(), true);
  277. EXPECT_EQ(mMidi.getType(), midi::SystemExclusive);
  278. EXPECT_EQ(mMidi.getChannel(), 0);
  279. EXPECT_EQ(mMidi.getSysExArrayLength(), rxSize);
  280. EXPECT_EQ(unsigned(mSerial.mTxBuffer.getLength()), rxSize);
  281. const std::vector<byte> sysExData(mMidi.getSysExArray(),
  282. mMidi.getSysExArray() + rxSize);
  283. EXPECT_THAT(sysExData, ElementsAreArray(rxData));
  284. }
  285. TEST_F(MidiInputCallbacks, sysExLong)
  286. {
  287. mMidi.setHandleSystemExclusive(handleSysEx);
  288. mMidi.begin(MIDI_CHANNEL_OMNI);
  289. mMidi.turnThruOff();
  290. static const unsigned rxSize = 210;
  291. static const byte rxData[rxSize] = {
  292. 0xf0,
  293. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  294. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  295. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  296. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  297. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  298. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  299. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  300. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  301. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  302. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  303. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  304. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  305. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  306. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  307. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  308. 'H','e','l','l','o',',',' ','W','o','r','l','d','!',
  309. 0xf7
  310. };
  311. mSerial.mRxBuffer.write(rxData, rxSize);
  312. for (unsigned i = 0; i < rxSize - 1; ++i)
  313. {
  314. EXPECT_EQ(mMidi.read(), false);
  315. }
  316. EXPECT_EQ(mMidi.read(), true);
  317. EXPECT_EQ(mMidi.getType(), midi::SystemExclusive);
  318. EXPECT_EQ(mMidi.getChannel(), 0);
  319. EXPECT_EQ(mMidi.getSysExArrayLength(), rxSize);
  320. EXPECT_EQ(unsigned(mSerial.mTxBuffer.getLength()), rxSize);
  321. const std::vector<byte> sysExData(mMidi.getSysExArray(),
  322. mMidi.getSysExArray() + rxSize);
  323. EXPECT_THAT(sysExData, ElementsAreArray(rxData));
  324. }
  325. // --
  326. void handleMtcQuarterFrame(byte inData)
  327. {
  328. EXPECT_NE(midi, nullptr);
  329. midi->sendTimeCodeQuarterFrame(inData);
  330. }
  331. TEST_F(MidiInputCallbacks, mtcQuarterFrame)
  332. {
  333. mMidi.setHandleTimeCodeQuarterFrame(handleMtcQuarterFrame);
  334. mMidi.begin(MIDI_CHANNEL_OMNI);
  335. mMidi.turnThruOff();
  336. static const unsigned rxSize = 2;
  337. static const byte rxData[rxSize] = { 0xf1, 12 };
  338. mSerial.mRxBuffer.write(rxData, rxSize);
  339. EXPECT_EQ(mMidi.read(), false);
  340. EXPECT_EQ(mMidi.read(), true);
  341. EXPECT_EQ(mMidi.getType(), midi::TimeCodeQuarterFrame);
  342. EXPECT_EQ(mMidi.getChannel(), 0);
  343. EXPECT_EQ(mMidi.getData1(), 12);
  344. EXPECT_EQ(mMidi.getData2(), 0);
  345. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 2);
  346. byte buffer[2] = { 0 };
  347. mSerial.mTxBuffer.read(buffer, 2);
  348. EXPECT_THAT(buffer, ContainerEq(rxData));
  349. }
  350. // --
  351. void handleSongPosition(unsigned inBeats)
  352. {
  353. EXPECT_NE(midi, nullptr);
  354. midi->sendSongPosition(inBeats);
  355. }
  356. TEST_F(MidiInputCallbacks, songPosition)
  357. {
  358. mMidi.setHandleSongPosition(handleSongPosition);
  359. mMidi.begin(MIDI_CHANNEL_OMNI);
  360. mMidi.turnThruOff();
  361. static const unsigned rxSize = 3;
  362. static const byte rxData[rxSize] = { 0xf2, 12, 34 };
  363. mSerial.mRxBuffer.write(rxData, rxSize);
  364. EXPECT_EQ(mMidi.read(), false);
  365. EXPECT_EQ(mMidi.read(), false);
  366. EXPECT_EQ(mMidi.read(), true);
  367. EXPECT_EQ(mMidi.getType(), midi::SongPosition);
  368. EXPECT_EQ(mMidi.getChannel(), 0);
  369. EXPECT_EQ(mMidi.getData1(), 12);
  370. EXPECT_EQ(mMidi.getData2(), 34);
  371. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 3);
  372. byte buffer[3] = { 0 };
  373. mSerial.mTxBuffer.read(buffer, 3);
  374. EXPECT_THAT(buffer, ContainerEq(rxData));
  375. }
  376. // --
  377. void handleSongSelect(byte inSongNumber)
  378. {
  379. EXPECT_NE(midi, nullptr);
  380. midi->sendSongSelect(inSongNumber);
  381. }
  382. TEST_F(MidiInputCallbacks, songSelect)
  383. {
  384. mMidi.setHandleSongSelect(handleSongSelect);
  385. mMidi.begin(MIDI_CHANNEL_OMNI);
  386. mMidi.turnThruOff();
  387. static const unsigned rxSize = 2;
  388. static const byte rxData[rxSize] = { 0xf3, 12 };
  389. mSerial.mRxBuffer.write(rxData, rxSize);
  390. EXPECT_EQ(mMidi.read(), false);
  391. EXPECT_EQ(mMidi.read(), true);
  392. EXPECT_EQ(mMidi.getType(), midi::SongSelect);
  393. EXPECT_EQ(mMidi.getChannel(), 0);
  394. EXPECT_EQ(mMidi.getData1(), 12);
  395. EXPECT_EQ(mMidi.getData2(), 0);
  396. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 2);
  397. byte buffer[2] = { 0 };
  398. mSerial.mTxBuffer.read(buffer, 2);
  399. EXPECT_THAT(buffer, ContainerEq(rxData));
  400. }
  401. // --
  402. void handleTuneRequest()
  403. {
  404. EXPECT_NE(midi, nullptr);
  405. midi->sendTuneRequest();
  406. }
  407. TEST_F(MidiInputCallbacks, tuneRequest)
  408. {
  409. mMidi.setHandleTuneRequest(handleTuneRequest);
  410. mMidi.begin(MIDI_CHANNEL_OMNI);
  411. mMidi.turnThruOff();
  412. mSerial.mRxBuffer.write(0xf6);
  413. EXPECT_EQ(mMidi.read(), true);
  414. EXPECT_EQ(mMidi.getType(), midi::TuneRequest);
  415. EXPECT_EQ(mMidi.getChannel(), 0);
  416. EXPECT_EQ(mMidi.getData1(), 0);
  417. EXPECT_EQ(mMidi.getData2(), 0);
  418. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 1);
  419. EXPECT_EQ(mSerial.mTxBuffer.read(), 0xf6);
  420. }
  421. // --
  422. void handleClock()
  423. {
  424. EXPECT_NE(midi, nullptr);
  425. midi->sendRealTime(midi::Clock);
  426. }
  427. void handleStart()
  428. {
  429. EXPECT_NE(midi, nullptr);
  430. midi->sendRealTime(midi::Start);
  431. }
  432. void handleContinue()
  433. {
  434. EXPECT_NE(midi, nullptr);
  435. midi->sendRealTime(midi::Continue);
  436. }
  437. void handleStop()
  438. {
  439. EXPECT_NE(midi, nullptr);
  440. midi->sendRealTime(midi::Stop);
  441. }
  442. void handleActiveSensing()
  443. {
  444. EXPECT_NE(midi, nullptr);
  445. midi->sendRealTime(midi::ActiveSensing);
  446. }
  447. void handleSystemReset()
  448. {
  449. EXPECT_NE(midi, nullptr);
  450. midi->sendRealTime(midi::SystemReset);
  451. }
  452. TEST_F(MidiInputCallbacks, realTime)
  453. {
  454. mMidi.setHandleClock(handleClock);
  455. mMidi.setHandleStart(handleStart);
  456. mMidi.setHandleContinue(handleContinue);
  457. mMidi.setHandleStop(handleStop);
  458. mMidi.setHandleActiveSensing(handleActiveSensing);
  459. mMidi.setHandleSystemReset(handleSystemReset);
  460. mMidi.begin(MIDI_CHANNEL_OMNI);
  461. mMidi.turnThruOff();
  462. static const unsigned rxSize = 6;
  463. static const byte rxData[rxSize] = {
  464. 0xf8, 0xfa, 0xfb, 0xfc, 0xfe, 0xff
  465. };
  466. mSerial.mRxBuffer.write(rxData, rxSize);
  467. static const midi::MidiType types[rxSize] = {
  468. midi::Clock,
  469. midi::Start,
  470. midi::Continue,
  471. midi::Stop,
  472. midi::ActiveSensing,
  473. midi::SystemReset,
  474. };
  475. for (unsigned i = 0; i < rxSize; ++i)
  476. {
  477. EXPECT_EQ(mMidi.read(), true);
  478. EXPECT_EQ(mMidi.getType(), types[i]);
  479. EXPECT_EQ(mMidi.getChannel(), 0);
  480. EXPECT_EQ(mMidi.getData1(), 0);
  481. EXPECT_EQ(mMidi.getData2(), 0);
  482. EXPECT_EQ(mSerial.mTxBuffer.getLength(), 1);
  483. const byte read = mSerial.mTxBuffer.read();
  484. EXPECT_EQ(read, rxData[i]);
  485. EXPECT_EQ(read, types[i]);
  486. }
  487. }
  488. END_UNNAMED_NAMESPACE