You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

85 lines
1.4 KiB

#include "unity.h"
#include <input.h>
#include <stdlib.h>
void setUp(void){
}
void tearDown(void){
}
//test arrowkeyinput
void test_testArrow(void){
char result = getTInput('\033');
TEST_ASSERT_EQUAL_CHAR('r', result);
}
//test input 'w'
void test_testw(void){
char result = getTInput('w');
TEST_ASSERT_EQUAL_CHAR('w', result);
}
//test input 'a'
void test_testa(void){
char result = getTInput('a');
TEST_ASSERT_EQUAL_CHAR('a', result);
}
//test input 's'
void test_tests(void){
char result = getTInput('s');
TEST_ASSERT_EQUAL_CHAR('s', result);
}
//test input 'd'
void test_testd(void){
char result = getTInput('d');
TEST_ASSERT_EQUAL_CHAR('d', result);
}
//test input 'q'
void test_testq(void){
char result = getTInput('q');
TEST_ASSERT_EQUAL_CHAR('q', result);
}
//test input 'p'
void test_testp(void){
char result = getTInput('p');
TEST_ASSERT_EQUAL_CHAR('p', result);
}
//test input invalid
void test_testn(void){
char result = getTInput('n');
TEST_ASSERT_EQUAL_CHAR('n', result);
}
//test input invalid
void test_testg(void){
char result = getTInput('g');
TEST_ASSERT_EQUAL_CHAR('n', result);
}
//test input invalid
void test_testb(void){
char result = getTInput('b');
TEST_ASSERT_EQUAL_CHAR('n', result);
}
//test input invalid
void test_testc(void){
char result = getTInput('c');
TEST_ASSERT_EQUAL_CHAR('n', result);
}
void test_testkbhit(void){
int result = kbhit();
TEST_ASSERT_EQUAL_INT(0, result);
}