@@ -1372,6 +1372,209 @@ int test_notecard_begin_serial_sets_serial_receive_function_pointer_to_nullptr_w
1372
1372
return result;
1373
1373
}
1374
1374
1375
+ int test_notecard_begin_serial_sends_a_card_aux_serial_request_to_throttle_aux_serial_data ()
1376
+ {
1377
+ int result;
1378
+
1379
+ // Arrange
1380
+ // //////////
1381
+
1382
+ Notecard notecard;
1383
+ NoteSerial_Mock mockSerial; // Instantiate NoteSerial (mocked)
1384
+ jAddNumberToObject_Parameters.reset ();
1385
+ noteNewRequest_Parameters.reset ();
1386
+ noteRequestWithRetry_Parameters.reset ();
1387
+ noteSetFnDefault_Parameters.reset ();
1388
+
1389
+ noteNewRequest_Parameters.result = reinterpret_cast <J *>(malloc (sizeof (J)));
1390
+
1391
+ // Action
1392
+ // /////////
1393
+
1394
+ notecard.begin (&mockSerial);
1395
+
1396
+ // Assert
1397
+ // /////////
1398
+
1399
+ if (noteRequestWithRetry_Parameters.invoked )
1400
+ {
1401
+ result = 0 ;
1402
+ }
1403
+ else
1404
+ {
1405
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
1406
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
1407
+ std::cout << " \t noteRequestWithRetry_Parameters.invoked == " << std::dec << noteRequestWithRetry_Parameters.invoked << " , EXPECTED: > 0" << std::endl;
1408
+ std::cout << " [" ;
1409
+ }
1410
+
1411
+ free (noteNewRequest_Parameters.result );
1412
+ return result;
1413
+ }
1414
+
1415
+ int test_notecard_begin_serial_sends_a_card_aux_serial_request_with_15_second_retry ()
1416
+ {
1417
+ int result;
1418
+
1419
+ // Arrange
1420
+ // //////////
1421
+
1422
+ Notecard notecard;
1423
+ NoteSerial_Mock mockSerial; // Instantiate NoteSerial (mocked)
1424
+ jAddNumberToObject_Parameters.reset ();
1425
+ noteNewRequest_Parameters.reset ();
1426
+ noteRequestWithRetry_Parameters.reset ();
1427
+ noteSetFnDefault_Parameters.reset ();
1428
+
1429
+ noteNewRequest_Parameters.result = reinterpret_cast <J *>(malloc (sizeof (J)));
1430
+
1431
+ // Action
1432
+ // /////////
1433
+
1434
+ notecard.begin (&mockSerial);
1435
+
1436
+ // Assert
1437
+ // /////////
1438
+
1439
+ if (15 == noteRequestWithRetry_Parameters.timeoutSeconds )
1440
+ {
1441
+ result = 0 ;
1442
+ }
1443
+ else
1444
+ {
1445
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
1446
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
1447
+ std::cout << " \t noteRequestWithRetry_Parameters.timeoutSeconds == " << std::dec << noteRequestWithRetry_Parameters.timeoutSeconds << " , EXPECTED: 15" << std::endl;
1448
+ std::cout << " [" ;
1449
+ }
1450
+
1451
+ free (noteNewRequest_Parameters.result );
1452
+ return result;
1453
+ }
1454
+
1455
+ int test_notecard_begin_serial_sends_a_card_aux_serial_request_with_max_parameter_set_to_arduino_serial_rx_buffer_size_constant_minus_one ()
1456
+ {
1457
+ int result;
1458
+
1459
+ // Arrange
1460
+ // //////////
1461
+
1462
+ Notecard notecard;
1463
+ NoteSerial_Mock mockSerial; // Instantiate NoteSerial (mocked)
1464
+ jAddNumberToObject_Parameters.reset ();
1465
+ noteNewRequest_Parameters.reset ();
1466
+ noteRequestWithRetry_Parameters.reset ();
1467
+ noteSetFnDefault_Parameters.reset ();
1468
+
1469
+ noteNewRequest_Parameters.result = reinterpret_cast <J *>(malloc (sizeof (J)));
1470
+
1471
+ // Action
1472
+ // /////////
1473
+
1474
+ notecard.begin (&mockSerial);
1475
+
1476
+ // Assert
1477
+ // /////////
1478
+
1479
+ if (" max" == jAddNumberToObject_Parameters.name [0 ]
1480
+ && (SERIAL_RX_BUFFER_SIZE - 1 ) == jAddNumberToObject_Parameters.number [0 ]
1481
+ ) {
1482
+ result = 0 ;
1483
+ }
1484
+ else
1485
+ {
1486
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
1487
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
1488
+ std::cout << " \t jAddNumberToObject_Parameters.name == \" " << std::dec << jAddNumberToObject_Parameters.name [0 ] << " \" , EXPECTED: \" max\" " << std::endl;
1489
+ std::cout << " \t jAddNumberToObject_Parameters.number == " << std::dec << jAddNumberToObject_Parameters.number [0 ] << " , EXPECTED: " << (SERIAL_RX_BUFFER_SIZE - 1 ) << std::endl;
1490
+ std::cout << " [" ;
1491
+ }
1492
+
1493
+ free (noteNewRequest_Parameters.result );
1494
+ return result;
1495
+ }
1496
+
1497
+ int test_notecard_begin_serial_sends_a_card_aux_serial_request_with_ms_parameter_set_to_one ()
1498
+ {
1499
+ int result;
1500
+
1501
+ // Arrange
1502
+ // //////////
1503
+
1504
+ Notecard notecard;
1505
+ NoteSerial_Mock mockSerial; // Instantiate NoteSerial (mocked)
1506
+ jAddNumberToObject_Parameters.reset ();
1507
+ noteNewRequest_Parameters.reset ();
1508
+ noteRequestWithRetry_Parameters.reset ();
1509
+ noteSetFnDefault_Parameters.reset ();
1510
+
1511
+ noteNewRequest_Parameters.result = reinterpret_cast <J *>(malloc (sizeof (J)));
1512
+
1513
+ // Action
1514
+ // /////////
1515
+
1516
+ notecard.begin (&mockSerial);
1517
+
1518
+ // Assert
1519
+ // /////////
1520
+
1521
+ if (" ms" == jAddNumberToObject_Parameters.name [1 ]
1522
+ && 1 == jAddNumberToObject_Parameters.number [1 ]
1523
+ ) {
1524
+ result = 0 ;
1525
+ }
1526
+ else
1527
+ {
1528
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
1529
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
1530
+ std::cout << " \t jAddNumberToObject_Parameters.name == \" " << std::dec << jAddNumberToObject_Parameters.name [1 ] << " \" , EXPECTED: \" ms\" " << std::endl;
1531
+ std::cout << " \t jAddNumberToObject_Parameters.number == " << std::dec << jAddNumberToObject_Parameters.number [1 ] << " , EXPECTED: 1" << std::endl;
1532
+ std::cout << " [" ;
1533
+ }
1534
+
1535
+ free (noteNewRequest_Parameters.result );
1536
+ return result;
1537
+ }
1538
+
1539
+ int test_notecard_begin_serial_does_not_send_a_card_aux_serial_request_when_interface_has_not_been_instantiated ()
1540
+ {
1541
+ int result;
1542
+
1543
+ // Arrange
1544
+ // //////////
1545
+
1546
+ Notecard notecard;
1547
+ jAddNumberToObject_Parameters.reset ();
1548
+ noteNewRequest_Parameters.reset ();
1549
+ noteRequestWithRetry_Parameters.reset ();
1550
+ noteSetFnDefault_Parameters.reset ();
1551
+
1552
+ noteNewRequest_Parameters.result = reinterpret_cast <J *>(malloc (sizeof (J)));
1553
+
1554
+ // Action
1555
+ // /////////
1556
+
1557
+ notecard.begin (static_cast <NoteSerial *>(nullptr ));
1558
+
1559
+ // Assert
1560
+ // /////////
1561
+
1562
+ if (!noteRequestWithRetry_Parameters.invoked )
1563
+ {
1564
+ result = 0 ;
1565
+ }
1566
+ else
1567
+ {
1568
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
1569
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
1570
+ std::cout << " \t noteRequestWithRetry_Parameters.invoked == " << std::dec << noteRequestWithRetry_Parameters.invoked << " , EXPECTED: 0" << std::endl;
1571
+ std::cout << " [" ;
1572
+ }
1573
+
1574
+ free (noteNewRequest_Parameters.result );
1575
+ return result;
1576
+ }
1577
+
1375
1578
int test_notecard_setDebugOutputStream_shares_a_debug_log_function_pointer ()
1376
1579
{
1377
1580
int result;
@@ -4635,6 +4838,11 @@ int main(void)
4635
4838
{test_notecard_begin_serial_sets_serial_available_function_pointer_to_nullptr_when_interface_has_not_been_instantiated, " test_notecard_begin_serial_sets_serial_available_function_pointer_to_nullptr_when_interface_has_not_been_instantiated" },
4636
4839
{test_notecard_begin_serial_shares_a_serial_receive_function_pointer, " test_notecard_begin_serial_shares_a_serial_receive_function_pointer" },
4637
4840
{test_notecard_begin_serial_sets_serial_receive_function_pointer_to_nullptr_when_interface_has_not_been_instantiated, " test_notecard_begin_serial_sets_serial_receive_function_pointer_to_nullptr_when_interface_has_not_been_instantiated" },
4841
+ {test_notecard_begin_serial_sends_a_card_aux_serial_request_to_throttle_aux_serial_data, " test_notecard_begin_serial_sends_a_card_aux_serial_request_to_throttle_aux_serial_data" },
4842
+ {test_notecard_begin_serial_sends_a_card_aux_serial_request_with_15_second_retry, " test_notecard_begin_serial_sends_a_card_aux_serial_request_with_15_second_retry" },
4843
+ {test_notecard_begin_serial_sends_a_card_aux_serial_request_with_max_parameter_set_to_arduino_serial_rx_buffer_size_constant_minus_one, " test_notecard_begin_serial_sends_a_card_aux_serial_request_with_max_parameter_set_to_arduino_serial_rx_buffer_size_constant_minus_one" },
4844
+ {test_notecard_begin_serial_sends_a_card_aux_serial_request_with_ms_parameter_set_to_one, " test_notecard_begin_serial_sends_a_card_aux_serial_request_with_ms_parameter_set_to_one" },
4845
+ {test_notecard_begin_serial_does_not_send_a_card_aux_serial_request_when_interface_has_not_been_instantiated, " test_notecard_begin_serial_does_not_send_a_card_aux_serial_request_when_interface_has_not_been_instantiated" },
4638
4846
{test_notecard_setDebugOutputStream_shares_a_debug_log_function_pointer, " test_notecard_setDebugOutputStream_shares_a_debug_log_function_pointer" },
4639
4847
{test_notecard_setDebugOutputStream_clears_the_debug_log_function_pointer_when_nullptr_is_provided, " test_notecard_setDebugOutputStream_clears_the_debug_log_function_pointer_when_nullptr_is_provided" },
4640
4848
{test_notecard_clearDebugOutputStream_clears_the_debug_log_function_pointer, " test_notecard_clearDebugOutputStream_clears_the_debug_log_function_pointer" },
0 commit comments