2011-08-25 18:24:36 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2011-09-03 21:04:27 +00:00
|
|
|
#include "CppUTest/TestHarness.h"
|
|
|
|
#include "CppUTest/CommandLineTestRunner.h"
|
|
|
|
|
2011-08-25 18:24:36 +00:00
|
|
|
#include "remote_device_db.h"
|
|
|
|
|
2011-09-03 21:04:27 +00:00
|
|
|
TEST_GROUP(RemoteDeviceDB){
|
|
|
|
bd_addr_t addr;
|
|
|
|
device_name_t device_name;
|
|
|
|
link_key_t link_key;
|
|
|
|
|
|
|
|
void setup(){
|
|
|
|
bd_addr_t addr = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
|
|
|
|
strcpy((char*)device_name, "matthias");
|
|
|
|
strcpy((char*)link_key, "matthias");
|
|
|
|
}
|
2011-08-25 19:12:09 +00:00
|
|
|
|
2011-09-03 21:04:27 +00:00
|
|
|
void teardown(){}
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST(RemoteDeviceDB, PutGetDeleteName){
|
2011-08-25 18:24:36 +00:00
|
|
|
remote_device_db_memory.put_name(&addr, &device_name);
|
2011-09-03 21:04:27 +00:00
|
|
|
CHECK(remote_device_db_memory.get_name(&addr, &device_name));
|
2011-08-25 18:24:36 +00:00
|
|
|
|
|
|
|
remote_device_db_memory.delete_name(&addr);
|
2011-09-03 21:04:27 +00:00
|
|
|
CHECK(!remote_device_db_memory.get_name(&addr, &device_name));
|
2011-08-25 18:24:36 +00:00
|
|
|
}
|
|
|
|
|
2011-09-03 21:04:27 +00:00
|
|
|
TEST(RemoteDeviceDB, PutGetDeleteKey){
|
|
|
|
remote_device_db_memory.put_link_key(&addr, &link_key);
|
|
|
|
CHECK(remote_device_db_memory.get_link_key(&addr, &link_key));
|
|
|
|
|
2011-08-25 18:24:36 +00:00
|
|
|
remote_device_db_memory.delete_link_key(&addr);
|
2011-09-03 21:04:27 +00:00
|
|
|
CHECK(!remote_device_db_memory.get_link_key(&addr, &link_key));
|
2011-08-25 18:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int main (int argc, const char * argv[]){
|
2011-09-03 21:04:27 +00:00
|
|
|
return CommandLineTestRunner::RunAllTests(argc, argv);
|
2011-08-25 18:24:36 +00:00
|
|
|
}
|