コード例 #1
0
ファイル: timer.test.c プロジェクト: antongulenko/TankOS
void test_invalid_timer() {
    t = Invalid(Timer);
    TEST_ASSERT_FALSE_MESSAGE(isPwmTimer(t), "invalid timer should not be pwm");
    TEST_ASSERT_FALSE_MESSAGE(IsValid(getTimerOutputPin(t)), "invalid timer should not have output pin");
    setTimerValue(t, 23); // Check for no segfault.
    TEST_ASSERT_EQUAL_MESSAGE(0, getTimerValue(t), "invalid timer should have 0 timer value");
}
コード例 #2
0
ファイル: timer.test.c プロジェクト: antongulenko/TankOS
void test_timer_create() {
    t = newTimer(OCR, TimerResolution8);
    TEST_ASSERT_TRUE_MESSAGE(timerValid(t), "Timer not valid after creation");
    Pin p = getTimerOutputPin(t);
    TEST_ASSERT_FALSE_MESSAGE(IsValid(p), "Non-pwm timer has output-pin");
    TEST_ASSERT_FALSE_MESSAGE(isPwmTimer(t), "Timer should not be pwm timer");
}
コード例 #3
0
ファイル: master.test.c プロジェクト: antongulenko/TankOS
void test_initialization() {
	TEST_ASSERT_EQUAL_HEX(_BV(TWEN) | _BV(TWIE), TWCR);
	TEST_ASSERT_EQUAL_HEX(0x00, TWDR);
    BOOL res = twi_init(testPin1, testPin2);
    TEST_ASSERT_FALSE_MESSAGE(res, "Second initialization of twi master should not be possible");
    TEST_ASSERT_EQUAL(PinTwiIO, pinOccupation(testPin1));
    TEST_ASSERT_EQUAL(PinTwiIO, pinOccupation(testPin2));
}
コード例 #4
0
ファイル: parse_string.c プロジェクト: Chinazhouwy/cJSON
static void assert_not_parse_string(const char * const string)
{
    parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } };
    buffer.content = (const unsigned char*)string;
    buffer.length = strlen(string) + sizeof("");
    buffer.hooks = global_hooks;

    TEST_ASSERT_FALSE_MESSAGE(parse_string(item, &buffer), "Malformed string should not be accepted.");
    assert_is_invalid(item);
}
コード例 #5
0
ファイル: analog.test.c プロジェクト: antongulenko/TankOS
void tearDown() {
    expect_conversion_start = FALSE;
    if (IsValid(analog1)) {
        analog1 = destroyAnalogInput(analog1);
        TEST_ASSERT_FALSE_MESSAGE(analogInputValid(analog1), "AnalogInput still valid after destroy");
        TEST_ASSERT_FALSE_MESSAGE(IsValid(analog1), "AnalogInput still valid after destroy");
        TEST_ASSERT_TRUE_MESSAGE(analog1destroyed, "AnalogInput descriptor was not destroyed");
    }
    if (IsValid(analog2)) {
        analog2 = destroyAnalogInput(analog2);
        TEST_ASSERT_FALSE_MESSAGE(analogInputValid(analog2), "AnalogInput still valid after destroy");
        TEST_ASSERT_FALSE_MESSAGE(IsValid(analog2), "AnalogInput still valid after destroy");
        TEST_ASSERT_TRUE_MESSAGE(analog2destroyed, "AnalogInput descriptor was not destroyed");
    }

    TEST_ASSERT_EQUAL(expected_finished_conversions, finished_conversions);

    // Make sure no conversions are started anymore
    triggerConversions();
    triggerConversions();
    triggerConversions();
}
コード例 #6
0
void assertNotCalledYet(BOOL *flag) {
	TEST_ASSERT_FALSE_MESSAGE(*flag, "Faked TWI utilized multiple times!");
	*flag = TRUE;
}
コード例 #7
0
ファイル: timer.test.c プロジェクト: antongulenko/TankOS
void test_pwm_timer_failedOccupation() {
    occupyPin(testPin1, 40);
    t = newPwmTimer(OCR, TimerResolution8, testPin1);
    TEST_ASSERT_FALSE_MESSAGE(IsValid(t), "timer should not be valid");
    TEST_ASSERT_FALSE_MESSAGE(timerValid(t), "timer should not pass validity check");
}