| 1 | #include "unity.h" |
| 2 | #include "Types.h" |
| 3 | #include "UsartHardware.h" |
| 4 | #include "AT91SAM7X256.h" |
| 5 | #include "MockUsartConfigurator.h" |
| 6 | #include "MockUsartPutChar.h" |
| 7 | |
| 8 | void setUp(void) |
| 9 | { |
| 10 | } |
| 11 | |
| 12 | void tearDown(void) |
| 13 | { |
| 14 | } |
| 15 | |
| 16 | void testInitShouldConfigureUsartPeripheralByCallingConfiguratorAppropriately(void) |
| 17 | { |
| 18 | Usart_ConfigureUsartIO_Expect(); |
| 19 | Usart_EnablePeripheralClock_Expect(); |
| 20 | Usart_Reset_Expect(); |
| 21 | Usart_ConfigureMode_Expect(); |
| 22 | Usart_SetBaudRateRegister_Expect(73); |
| 23 | Usart_Enable_Expect(); |
| 24 | |
| 25 | UsartHardware_Init(73); |
| 26 | } |
| 27 | |
| 28 | void testTransmitStringShouldSendDesiredStringOutUsingUsart(void) |
| 29 | { |
| 30 | Usart_PutChar_Expect('h'); |
| 31 | Usart_PutChar_Expect('e'); |
| 32 | Usart_PutChar_Expect('l'); |
| 33 | Usart_PutChar_Expect('l'); |
| 34 | Usart_PutChar_Expect('o'); |
| 35 | |
| 36 | UsartHardware_TransmitString("hello"); |
| 37 | } |