重构代码的架构设计,增加测试单元,提高代码可靠性
This commit is contained in:
16
tests/test_p1_key.c
Normal file
16
tests/test_p1_key.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "../src/Drv/key.h"
|
||||
#include "test_common.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
Key_Init();
|
||||
ASSERT_EQ_INT(EN_KEY_FLAG_NULL, g_tRemoteKey.byKeyValid);
|
||||
ASSERT_EQ_INT(KEY_NONE, g_tRemoteKey.byKeyValue);
|
||||
|
||||
g_tRemoteKey.byKeyValid = EN_KEY_FLAG_NEW;
|
||||
g_tRemoteKey.byKeyValue = KEY_U;
|
||||
ASSERT_EQ_INT(KEY_U, Key_Read());
|
||||
ASSERT_EQ_INT(EN_KEY_FLAG_NULL, g_tRemoteKey.byKeyValid);
|
||||
ASSERT_EQ_INT(KEY_NONE, Key_Read());
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user