コード例 #1
0
ファイル: test_pwm.c プロジェクト: PrinceBalabis/mahm3lib
void test_pwm_channel_disabled() {
	pwm_reset_peripheral();
	pwm_enable_channel(PWM_CHANNEL_3);
	TEST_ASSERT_BITS_HIGH((1<<PWM_CHANNEL_3), PWM->PWM_SR);
	pwm_disable_channel(PWM_CHANNEL_3);
	TEST_ASSERT_BITS_LOW((1<<PWM_CHANNEL_3), PWM->PWM_SR);
}
コード例 #2
0
ファイル: testunity.c プロジェクト: chaicko/tdd_book_code
void testEqualBits(void)
{
    _UU32 v0 = 0xFF55AA00;
    _UU32 v1 = 0x55550000;

    TEST_ASSERT_BITS(v1, v0, 0x55550000);
    TEST_ASSERT_BITS(v1, v0, 0xFF55CC00);
    TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00);
    TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0);
    TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F);
    TEST_ASSERT_BITS_HIGH(v1, v0);
    TEST_ASSERT_BITS_LOW(0x000055FF, v0);
    TEST_ASSERT_BIT_HIGH(30, v0);
    TEST_ASSERT_BIT_LOW(5, v0);
}
コード例 #3
0
void test_should_raise_single_event_on_buffer_full() {
	uint8_t buffer_data[BUFFER_MAX_ELEMENTS];
	struct buffer buffer = buffer_init(buffer_data, BUFFER_MAX_ELEMENTS, sizeof(uint8_t));
	buffer_event_add_listener(&buffer, buffer_event_handler);

	for (uint8_t i = 0; i < BUFFER_MAX_ELEMENTS - 1; i++) {
		buffer_push_overflow(&buffer, &i);
		event_tick();
	}
	TEST_ASSERT_EQUAL_UINT(0, callback_count);
	
	buffer_push_overflow(&buffer, &(uint8_t){ 1 });
	event_tick();
	TEST_ASSERT_EQUAL_UINT(1, callback_count);
	TEST_ASSERT_EQUAL_PTR(&buffer, last_event.descriptor.address);
	TEST_ASSERT_BITS_HIGH(BUFFER_FULL, last_event.flags);

	for (uint8_t i = 0; i < BUFFER_MAX_ELEMENTS; i++) {
		buffer_push_overflow(&buffer, &i);
		event_tick();
	}
	TEST_ASSERT_EQUAL_UINT(1, callback_count);
}