Como escrevo uma função de teste para outra função que usa a entrada stdi

Tenho as seguintes funções como parte de um trabalho da faculdade:

int readMenuOption()
{
   /* local declarations */
   char option[2];
   /* read in 1 char from stdin plus 1 char for string termination character */
   readStdin(1 + 1, option);
   return (int)option[0] <= ASCII_OFFSET ? 0 : (int)option[0] - ASCII_OFFSET;
}

int readStdin(int limit, char *buffer) 
{
   char c;
   int i = 0;
   int read = FALSE;
   while ((c = fgetc(stdin)) != '\n') {
      /* if the input string buffer has already reached it maximum
       limit, then abandon any other excess characters. */
      if (i <= limit) {
         *(buffer + i) = c;
         i++;
         read = TRUE;
      }
   }
   /* clear the remaining elements of the input buffer with a null character. */
   for (i = i; i < strlen(buffer); i++) {
      *(buffer + i) = '\0';
   }
   return read;
}

Funciona perfeitamente para o que eu preciso fazer (pegue a entrada do teclado). Eu tive que fazer isso usando stdin (como eu fiz) por causa de vários requisitos descritos pelo meu professor.

Quero escrever uma série de "testes de unidade" para a tarefa, mas não sei como chamar minhas funções de testereadMenuOption() e passar a entrada para ele (sem ter que fazê-lo em tempo de execução

Isso é possível e, em caso afirmativo, como posso fazer isso? (ou seja, é possível gravar no stdin)?

questionAnswers(3)

yourAnswerToTheQuestion