2009-12-21 01:02:40 +01:00
|
|
|
#include "test.h"
|
|
|
|
|
2009-12-21 14:58:53 +01:00
|
|
|
DEFINE_TEST(test_mad)
|
2009-12-21 01:02:40 +01:00
|
|
|
{
|
|
|
|
int res;
|
|
|
|
|
|
|
|
do {
|
|
|
|
Mad mad = mad_new (1);
|
|
|
|
assert (mad != NULL);
|
|
|
|
|
|
|
|
if (mad) {
|
|
|
|
assertEqualInt (mad_get_version (mad), 1);
|
|
|
|
mad_set_version (mad, 2);
|
|
|
|
assertEqualInt (mad_get_version (mad), 2);
|
|
|
|
|
|
|
|
assertEqualInt (0, mad_get_card_publisher_sector (mad));
|
|
|
|
|
|
|
|
res = mad_set_card_publisher_sector (mad, 13);
|
|
|
|
assertEqualInt (res, 0);
|
|
|
|
assertEqualInt (13, mad_get_card_publisher_sector (mad));
|
|
|
|
|
|
|
|
res = mad_set_card_publisher_sector (mad, 0xff);
|
|
|
|
assertEqualInt (res, -1);
|
|
|
|
assertEqualInt (13, mad_get_card_publisher_sector (mad));
|
|
|
|
|
2009-12-21 04:02:15 +01:00
|
|
|
MadAid aid = {
|
|
|
|
.function_cluster_code = 0,
|
|
|
|
.application_code = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
res = mad_get_aid (mad, 3, &aid);
|
2009-12-21 01:02:40 +01:00
|
|
|
assertEqualInt (res, 0);
|
2009-12-21 04:02:15 +01:00
|
|
|
assertEqualInt (aid.function_cluster_code, 0);
|
|
|
|
assertEqualInt (aid.application_code, 0);
|
2009-12-21 01:02:40 +01:00
|
|
|
|
2009-12-21 04:02:15 +01:00
|
|
|
aid.function_cluster_code = 0xc0;
|
|
|
|
aid.application_code = 0x42;
|
|
|
|
res = mad_set_aid (mad, 3, aid);
|
2009-12-21 01:02:40 +01:00
|
|
|
assertEqualInt (res, 0);
|
|
|
|
|
2009-12-21 04:02:15 +01:00
|
|
|
res = mad_get_aid (mad, 3, &aid);
|
2009-12-21 01:02:40 +01:00
|
|
|
assertEqualInt (res, 0);
|
2009-12-21 04:02:15 +01:00
|
|
|
assertEqualInt (aid.function_cluster_code, 0xc0);
|
|
|
|
assertEqualInt (aid.application_code, 0x42);
|
2009-12-21 01:02:40 +01:00
|
|
|
|
|
|
|
mad_free (mad);
|
|
|
|
}
|
|
|
|
|
|
|
|
} while (0);
|
|
|
|
}
|
|
|
|
|