#include "TestCommon.h"

/* Print the start infomation of a test case */
void print_test_start(const uint8_t *i_p_test_case)
{
  printf("\r\n------------------ %s Start ------------------\r\n\r\n", i_p_test_case);
}

/* Print the end infomation of a test case */
void print_test_end(const uint8_t *i_p_test_case)
{
  printf("\r\n------------------ %s End --------------------\r\n", i_p_test_case);
}

/* The refered result printing of Single Step Debug result */
void print_refered_single_debug_res(uint8_t *i_p_refered_info)
{
  printf("For more information, Please refer to\r\n%s\r\n\r\n", i_p_refered_info);
}

/* Check the result of the test case */
TestResult check_res_test(uint16_t i_res_steps, uint8_t i_total_steps, const uint8_t *i_p_test_case)
{
  uint8_t l_cnt_circle = 0;
  TestResult l_res_check = TEST_SUCCESS;
  
  while(l_cnt_circle < i_total_steps)
  {
    if(!(i_res_steps & (1 << l_cnt_circle++)))
    {
      l_res_check = TEST_FAILED;
      break;
    }
  }
  
  if(TEST_SUCCESS == l_res_check)
  {
    printf("%s is OK\r\n", i_p_test_case);
  }
  else if(TEST_FAILED == l_res_check)
  {
    printf("%s is NG\r\n", i_p_test_case);
  }
    
  return l_res_check;
}

/* Print current test step */
void print_test_step(const uint8_t i_cur_step)
{
  printf("\r\n#### Step %d ####\r\n", i_cur_step);
}

/* Print common string */
void print_common_string(uint8_t *i_p_str)
{
  printf("%s\r\n", i_p_str);
}

/* Delay function */
void sys_delay(uint32_t i_delay_time)
{
  while(i_delay_time--);
}
