mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-13 04:13:54 +00:00
extended testing of put_name and put_link_key by two scenarios: add device with name and serach by key, and vice versa
This commit is contained in:
parent
3eabd1d741
commit
bcee79c840
@ -2,11 +2,11 @@
|
||||
#include <string.h>
|
||||
#include "remote_device_db.h"
|
||||
|
||||
bd_addr_t addr = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
|
||||
device_name_t device_name = {'m', 'a', 't', 't'};
|
||||
link_key_t link_key = {'h', 'i', 'a', 's'};
|
||||
|
||||
void testPutGetDeleteName(void){
|
||||
bd_addr_t addr = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
|
||||
device_name_t device_name;
|
||||
strcpy(device_name, "matthias");
|
||||
|
||||
remote_device_db_memory.put_name(&addr, &device_name);
|
||||
if (remote_device_db_memory.get_name(&addr, &device_name)) {
|
||||
printf("OK ------> found device \n");
|
||||
@ -20,13 +20,17 @@ void testPutGetDeleteName(void){
|
||||
} else {
|
||||
printf("OK ------> device deleted \n");
|
||||
};
|
||||
|
||||
remote_device_db_memory.put_link_key(&addr, &link_key);
|
||||
if (remote_device_db_memory.get_name(&addr, &device_name)) {
|
||||
printf("ERROR ------> no device with such name\n");
|
||||
} else {
|
||||
printf("OK ------> device with such name does not exist \n");
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void testPutGetDeleteKey(void){
|
||||
bd_addr_t addr = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
|
||||
link_key_t link_key;
|
||||
strcpy(link_key, "matthias");
|
||||
|
||||
remote_device_db_memory.put_link_key(&addr, &link_key);
|
||||
if (remote_device_db_memory.get_link_key(&addr, &link_key)) {
|
||||
printf("OK ------> found key \n");
|
||||
@ -40,13 +44,20 @@ void testPutGetDeleteKey(void){
|
||||
} else {
|
||||
printf("OK ------> key deleted \n");
|
||||
};
|
||||
|
||||
remote_device_db_memory.put_name(&addr, &device_name);
|
||||
if (remote_device_db_memory.get_link_key(&addr, &link_key)) {
|
||||
printf("ERROR ------> no device with such link key\n");
|
||||
} else {
|
||||
printf("OK ------> device with such link key does not exist \n");
|
||||
};
|
||||
}
|
||||
|
||||
int main (int argc, const char * argv[]){
|
||||
|
||||
printf("\n<remote_device_db_memory_test> \n");
|
||||
testPutGetDeleteName();
|
||||
testPutGetDeleteKey();
|
||||
printf("DONE \n\n");
|
||||
printf("</remote_device_db_memory_test> \n\n");
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user