Introduce MAD application management functions.
This commit is contained in:
parent
0ae63092bd
commit
3cab1523eb
6 changed files with 225 additions and 4 deletions
37
test/test_mifare_application.c
Normal file
37
test/test_mifare_application.c
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include "test.h"
|
||||
|
||||
DEFINE_TEST(test_mifare_application)
|
||||
{
|
||||
do {
|
||||
|
||||
/* Card publisher part */
|
||||
|
||||
MadAid aid = { 0x22, 0x42 };
|
||||
Mad mad = mad_new (2);
|
||||
assert (NULL != mad);
|
||||
|
||||
MifareSectorNumber *s_alloc = mifare_application_alloc (mad, aid, 3);
|
||||
assert (NULL != s_alloc);
|
||||
|
||||
MifareSectorNumber *s_found = mifare_application_find (mad, aid);
|
||||
assert (NULL != s_found);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
assertEqualInt (s_alloc[i], s_found[i]);
|
||||
}
|
||||
|
||||
assertEqualInt (0, s_alloc[3]);
|
||||
assertEqualInt (0, s_found[3]);
|
||||
|
||||
mifare_application_free (mad, aid);
|
||||
|
||||
free (s_alloc);
|
||||
free (s_found);
|
||||
|
||||
s_found = mifare_application_find (mad, aid);
|
||||
assert (s_found == NULL);
|
||||
|
||||
mad_free (mad);
|
||||
|
||||
} while (0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue