Massive code clean up: (Fixes Issue 161)
- Remove typedef from internal structs - Remove _t suffix from types - Fix tests using connstrings
This commit is contained in:
parent
55daa29a7c
commit
c718fafee7
47 changed files with 546 additions and 533 deletions
|
|
@ -14,31 +14,31 @@ void
|
|||
test_access_storm (void)
|
||||
{
|
||||
int n = NTESTS;
|
||||
nfc_device_desc_t devices[MAX_DEVICE_COUNT];
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
size_t device_count, ref_device_count, target_count;
|
||||
bool res;
|
||||
|
||||
nfc_list_devices (devices, MAX_DEVICE_COUNT, &ref_device_count);
|
||||
nfc_list_devices (connstrings, MAX_DEVICE_COUNT, &ref_device_count);
|
||||
if (!ref_device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
||||
while (n) {
|
||||
size_t i;
|
||||
|
||||
nfc_list_devices (devices, MAX_DEVICE_COUNT, &device_count);
|
||||
nfc_list_devices (connstrings, MAX_DEVICE_COUNT, &device_count);
|
||||
cut_assert_equal_int (ref_device_count, device_count, cut_message ("device count"));
|
||||
|
||||
for (i = 0; i < device_count; i++) {
|
||||
nfc_device_t *device;
|
||||
nfc_target_t ant[MAX_TARGET_COUNT];
|
||||
nfc_device *device;
|
||||
nfc_target ant[MAX_TARGET_COUNT];
|
||||
|
||||
device = nfc_connect (&(devices[i]));
|
||||
device = nfc_connect (&(connstrings[i]));
|
||||
cut_assert_not_null (device, cut_message ("nfc_connect"));
|
||||
|
||||
res = nfc_initiator_init(device);
|
||||
cut_assert_true (res, cut_message ("nfc_initiator_init"));
|
||||
|
||||
const nfc_modulation_t nm = {
|
||||
const nfc_modulation nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_106,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
#define TARGET 1
|
||||
|
||||
pthread_t threads[2];
|
||||
nfc_device_desc_t device_descriptions[2];
|
||||
nfc_device_t *devices[2];
|
||||
nfc_connstring connstrings[2];
|
||||
nfc_device *devices[2];
|
||||
intptr_t result[2];
|
||||
|
||||
void
|
||||
|
|
@ -28,13 +28,13 @@ cut_setup (void)
|
|||
{
|
||||
size_t n;
|
||||
|
||||
nfc_list_devices (device_descriptions, 2, &n);
|
||||
nfc_list_devices (connstrings, 2, &n);
|
||||
if (n < 2) {
|
||||
cut_omit ("At least two NFC devices must be plugged-in to run this test");
|
||||
}
|
||||
|
||||
devices[TARGET] = nfc_connect (&device_descriptions[TARGET]);
|
||||
devices[INITIATOR] = nfc_connect (&device_descriptions[INITIATOR]);
|
||||
devices[TARGET] = nfc_connect (&connstrings[TARGET]);
|
||||
devices[INITIATOR] = nfc_connect (&connstrings[INITIATOR]);
|
||||
|
||||
signal (SIGINT, abort_test_by_keypress);
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ cut_teardown (void)
|
|||
}
|
||||
|
||||
struct thread_data {
|
||||
nfc_device_t *device;
|
||||
nfc_device *device;
|
||||
void *cut_test_context;
|
||||
};
|
||||
|
||||
|
|
@ -55,11 +55,11 @@ void *
|
|||
target_thread (void *arg)
|
||||
{
|
||||
intptr_t thread_res = 0;
|
||||
// nfc_device_t *device = ((struct thread_data *) arg)->device;
|
||||
// nfc_device *device = ((struct thread_data *) arg)->device;
|
||||
cut_set_current_test_context (((struct thread_data *) arg)->cut_test_context);
|
||||
|
||||
#if 0
|
||||
nfc_target_t nt = {
|
||||
nfc_target nt = {
|
||||
.nm = {
|
||||
.nmt = NMT_DEP,
|
||||
.nbr = NBR_UNDEFINED
|
||||
|
|
@ -106,7 +106,7 @@ void *
|
|||
initiator_thread (void *arg)
|
||||
{
|
||||
intptr_t thread_res = 0;
|
||||
// nfc_device_t *device = ((struct thread_data *) arg)->device;
|
||||
// nfc_device *device = ((struct thread_data *) arg)->device;
|
||||
cut_set_current_test_context (((struct thread_data *) arg)->cut_test_context);
|
||||
|
||||
cut_fail("plop");
|
||||
|
|
@ -122,7 +122,7 @@ initiator_thread (void *arg)
|
|||
bool res = nfc_initiator_init (device);
|
||||
// cut_assert_true (res, cut_message ("Can't initialize NFC device as initiator"));
|
||||
|
||||
nfc_target_t nt;
|
||||
nfc_target nt;
|
||||
|
||||
// Passive mode / 212Kbps
|
||||
res = nfc_initiator_select_dep_target (device, NDM_PASSIVE, NBR_212, NULL, &nt);
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@
|
|||
void
|
||||
test_register_endianness (void)
|
||||
{
|
||||
nfc_device_desc_t devices[MAX_DEVICE_COUNT];
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
size_t device_count;
|
||||
bool res;
|
||||
|
||||
nfc_list_devices (devices, MAX_DEVICE_COUNT, &device_count);
|
||||
nfc_list_devices (connstrings, MAX_DEVICE_COUNT, &device_count);
|
||||
if (!device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
||||
nfc_device_t *device;
|
||||
nfc_device *device;
|
||||
|
||||
device = nfc_connect (&(devices[0]));
|
||||
device = nfc_connect (&(connstrings[0]));
|
||||
cut_assert_not_null (device, cut_message ("nfc_connect"));
|
||||
|
||||
uint8_t value;
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@
|
|||
void
|
||||
test_register_endianness (void)
|
||||
{
|
||||
nfc_device_desc_t devices[MAX_DEVICE_COUNT];
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
size_t device_count;
|
||||
bool res;
|
||||
|
||||
nfc_list_devices (devices, MAX_DEVICE_COUNT, &device_count);
|
||||
nfc_list_devices (connstrings, MAX_DEVICE_COUNT, &device_count);
|
||||
if (!device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
||||
nfc_device_t *device;
|
||||
nfc_device *device;
|
||||
|
||||
device = nfc_connect (&(devices[0]));
|
||||
device = nfc_connect (&(connstrings[0]));
|
||||
cut_assert_not_null (device, cut_message ("nfc_connect"));
|
||||
|
||||
uint8_t value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue