Sha256: 5c05aca76f10f04b3774e1edc38672724f563e5dc2577e82f566063a4fd2bda3

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

/* =========================================================================
    CMock - Automatic Mock Generation for C
    ThrowTheSwitch.org
    Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
    SPDX-License-Identifier: MIT
========================================================================= */

#include "unity.h"
#include "Types.h"
#include "UsartPutChar.h"
#include "MockUsartTransmitBufferStatus.h"

AT91S_USART Usart0Peripheral;

void setUp(void)
{
}

void tearDown(void)
{
}

void testPutCharShouldWriteDesiredCharacterToUsartTransmitBuffer(void)
{
  AT91C_BASE_US0->US_THR = 0;
  
  Usart_ReadyToTransmit_ExpectAndReturn(TRUE);
  Usart_PutChar('x');
  TEST_ASSERT_EQUAL('x', AT91C_BASE_US0->US_THR);
  
  Usart_ReadyToTransmit_ExpectAndReturn(TRUE);
  Usart_PutChar('1');
  TEST_ASSERT_EQUAL('1', AT91C_BASE_US0->US_THR);
  
  Usart_ReadyToTransmit_ExpectAndReturn(TRUE);
  Usart_PutChar(':');
  TEST_ASSERT_EQUAL(':', AT91C_BASE_US0->US_THR);
}

void testPutCharShouldWaitUntilReadyToTransmitBeforeLoadingTransmitBufffer(void)
{
  AT91C_BASE_US0->US_THR = 0;
  
  Usart_ReadyToTransmit_ExpectAndReturn(FALSE);
  Usart_ReadyToTransmit_ExpectAndReturn(FALSE);
  Usart_ReadyToTransmit_ExpectAndReturn(FALSE);
  Usart_ReadyToTransmit_ExpectAndReturn(TRUE);
  Usart_PutChar('x');
  TEST_ASSERT_EQUAL('x', AT91C_BASE_US0->US_THR);
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ceedling-1.0.1 vendor/cmock/examples/temp_sensor/test/TestUsartPutChar.c
ceedling-1.0.0 vendor/cmock/examples/temp_sensor/test/TestUsartPutChar.c