void unity_run_menu() { int test_count = print_test_menu(); while (true) { char cmdline[256] = { 0 }; while(strlen(cmdline) == 0) { /* Flush anything already in the RX buffer */ while(uart_rx_one_char((uint8_t *) cmdline) == OK) { } /* Read input */ UartRxString((uint8_t*) cmdline, sizeof(cmdline) - 1); trim_trailing_space(cmdline); if(strlen(cmdline) == 0) { /* if input was newline, print a new menu */ print_test_menu(); } } UNITY_BEGIN(); size_t idx = 0; if (cmdline[idx] == '!') { s_invert = true; ++idx; } else { s_invert = false; } if (cmdline[idx] == '*') { unity_run_all_tests(); } else if (cmdline[idx] =='[') { unity_run_tests_with_filter(cmdline + idx); } else if (cmdline[idx] =='"') { unity_run_single_test_by_name(cmdline + idx); } else if (isdigit((unsigned char)cmdline[idx])) { unity_run_single_test_by_index_parse(cmdline + idx, test_count); } UNITY_END(); printf("Enter next test, or 'enter' to see menu\n"); } }
void unity_gets(char *dst, size_t len) { size_t unity_input_from_gdb_len = strlen(unity_input_from_gdb); if (unity_input_from_gdb_len > 0 && unity_input_from_gdb_len < len - 1) { memcpy(dst, unity_input_from_gdb, unity_input_from_gdb_len); dst[unity_input_from_gdb_len] = '\n'; dst[unity_input_from_gdb_len + 1] = 0; memset(unity_input_from_gdb, 0, sizeof(unity_input_from_gdb)); return; } /* UartRxString length argument is uint8_t */ if (len >= UINT8_MAX) { len = UINT8_MAX; } /* Flush anything already in the RX buffer */ uint8_t ignore; while (uart_rx_one_char(&ignore) == OK) { } /* Read input */ UartRxString((uint8_t *) dst, len); }