/* for documentation check os_test.h */ void test_result(int result) { result_store = result; if (0 == result) test_debug("Test PASSED"); else test_debug("Test FAILURE"); #ifndef TEST_BLINK arch_halt(); #else /* instead of arch_halt() blik the led */ while (1) { uint16_t i = 0; PORTB |= _BV(PORTB5); _delay_ms(1000); PORTB &= ~_BV(PORTB5); _delay_ms(1000); test_debug("Result loop %"PRIu16, i++); } #endif }
void test_result(int result) { result_store = result; unsigned i = 0; if(0 == result) { test_debug("Test PASSED"); } else { test_debug("Test FAILURE"); } #ifndef TEST_BLINK arch_halt(); #else /* instead of arch_halt() blik the led */ while (1) { PORTB |= _BV(PORTB5); _delay_ms(1000); PORTB &= ~_BV(PORTB5); _delay_ms(1000); test_debug("Result loop %u", i++); } #endif }
void Sim::queueSim() { if(!doSim) { if(test_debug(1)) errlogPrintf("%s: do sim\n", name.c_str()); doSim = true; event.signal(); } else { if(test_debug(1)) errlogPrintf("%s: sim already pending\n", name.c_str()); } }
int main() { test_version(); test_debug(); return 0; }
int main(int argc,char *argv[]){ check(argc==2,"Need an argument."); test_debug(); test_log_err(); test_log_warn(); test_log_info(); check(test_check("ex20.c")==0,"no ex20.cc file exists"); check(test_check(argv[1]) == -1, "failed with argv"); return 0; error: return 1; }
/** * The main task for tests manage */ int task_main_proc(void *OS_UNUSED(param)) { int ret; do { ret = testcase_1(); if (ret) { test_debug("Testcase 1 failure"); break; } ret = testcase_regresion(); if (ret) { test_debug("Testcase regresion failure"); break; } } while (0); test_result(ret); return 0; }
/* for documentation check os_test.h */ void test_setupmain(const OS_PROGMEM char *test_name) { #ifdef TEST_BLINK /* For Arduino set portB as output */ DDRB |= _BV(DDB5); /* switch off the test LED */ PORTB &= ~_BV(PORTB5); #endif uart_init(); /* below we use %S (capital) since test_name param is OS_PROGMEM */ test_debug("Starting test: %S", test_name); }
int main(int argc, char *argv[]){ check(argc == 2, "Need an argument."); test_debug(); test_log_err(); test_log_warn(); test_log_info(); check(test_check("ex19.c") == 0, "failed with ex19.c"); check(test_check(argv[1]) == -1, "failed with argv"); check(test_sentinel(1) == 0, "test_sentinel failed."); check(test_sentinel(100) == -1, "test_sentinel failed."); check(test_check_mem() == -1, "test_check_mem failed."); check(test_check_debug() == -1, "test_check_debug failed."); return 0; error: return 1; }