3 #include "full_duplex_serial.h"
7 #include "board/board_unit_tester.h"
9 const int rxpin = libpropeller::Board::kPinTie1a;
10 const int txpin = libpropeller::Board::kPinTie1b;
11 const int baud = 230400;
20 static void setUp(
void) {
22 sut->Start(rxpin, txpin, 0, baud);
25 static void tearDown(
void) {
31 static void test_BasicRxTx(
void) {
34 TEST_ASSERT_EQUAL_INT(letter, sut->Get());
37 static void test_RxcheckWithNothingInBuffer(
void) {
38 TEST_ASSERT_EQUAL_INT(-1, sut->Get(
TIMEOUT));
41 static void test_BasicRxCheckTx(
void) {
45 TEST_ASSERT_EQUAL_INT(letter, sut->Get(
TIMEOUT));
48 static void test_PutGetMultipleBytes(
void) {
49 for (
char letter =
'a'; letter <=
'z'; letter++) {
52 TEST_ASSERT_EQUAL_INT(letter, sut->Get());
56 static void test_RxflushClearsBuffer(
void) {
66 TEST_ASSERT_EQUAL_INT(-1, sut->Get(
TIMEOUT));
69 static void test_PutLongString(
void) {
70 char string [] =
"Hello, World! I'm a Propeller. What are you?";
71 int length = strlen(
string);
75 for (
int i = 0; i < length; i++) {
76 TEST_ASSERT_EQUAL_INT(
string[i], sut->Get(
TIMEOUT));
79 TEST_ASSERT_EQUAL_INT(-1, sut->Get(
TIMEOUT));
83 static void test_PutEmptyString(
void) {
87 TEST_ASSERT_EQUAL_INT(-1, sut->Get(
TIMEOUT));