diff --git a/test/Makefile.am b/test/Makefile.am index 02e04d3..163e11e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -14,8 +14,9 @@ TESTS_ENVIRONMENT = NO_MAKE=yes CUTTER="$(CUTTER)" noinst_LTLIBRARIES = \ test_mad.la \ test_mifare_classic.la \ - test_mifare_classic_create_trailer_block.la \ test_mifare_classic_application.la \ + test_mifare_classic_create_trailer_block.la \ + test_mifare_classic_sector_boundaries.la \ test_mifare_ultralight.la \ test_tlv.la @@ -29,12 +30,15 @@ test_mifare_classic_la_SOURCES = test_mifare_classic.c \ mifare_classic_fixture.h test_mifare_classic_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la -test_mifare_classic_create_trailer_block_la_SOURCES = test_mifare_classic_create_trailer_block.c -test_mifare_classic_create_trailer_block_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la - test_mifare_classic_application_la_SOURCES = test_mifare_classic_application.c test_mifare_classic_application_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la +test_mifare_classic_sector_boundaries_la_SOURCES = test_mifare_classic_sector_boundaries.c +test_mifare_classic_sector_boundaries_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la + +test_mifare_classic_create_trailer_block_la_SOURCES = test_mifare_classic_create_trailer_block.c +test_mifare_classic_create_trailer_block_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la + test_mifare_ultralight_la_SOURCES = test_mifare_ultralight.c \ mifare_ultralight_fixture.c \ mifare_ultralight_fixture.h diff --git a/test/test_mifare_classic.c b/test/test_mifare_classic.c index aa6d9ab..e9380b7 100644 --- a/test/test_mifare_classic.c +++ b/test/test_mifare_classic.c @@ -339,22 +339,3 @@ test_mifare_classic_get_uid (void) free (uid); } -void -test_mifare_classic_sector_boundaries (void) -{ - cut_notify ("No MIFARE Classic target is required for this test"); - for (int i=0; i < 32; i++) { - for (int j=0; j < 4; j++) { - cut_assert_equal_int (4 * i, mifare_classic_first_sector_block (4 * i), cut_message ("Wrong first block number for block %d", i)); - cut_assert_equal_int (4 * i + 3, mifare_classic_last_sector_block (4 * i + j), cut_message ("Wrong last block number for block %d", i)); - } - } - - for (int i=0; i < 8; i++) { - for (int j=0; j < 16; j++) { - cut_assert_equal_int (128 + 16 * i, mifare_classic_first_sector_block (128 + 16 * i), cut_message ("Wrong last block number for block %d", i)); - cut_assert_equal_int (128 + 16 * i + 15, mifare_classic_last_sector_block (128 + 16 * i + j), cut_message ("Wrong last block number for block %d", i)); - } - } -} - diff --git a/test/test_mifare_classic_sector_boundaries.c b/test/test_mifare_classic_sector_boundaries.c new file mode 100644 index 0000000..7c0ba6b --- /dev/null +++ b/test/test_mifare_classic_sector_boundaries.c @@ -0,0 +1,42 @@ +/*- + * Copyright (C) 2010, Romain Tartiere, Romuald Conty. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see + * + * $Id$ + */ + +#include + +#include +#include "freefare_internal.h" + +void +test_mifare_classic_sector_boundaries (void) +{ + for (int i=0; i < 32; i++) { + for (int j=0; j < 4; j++) { + cut_assert_equal_int (4 * i, mifare_classic_first_sector_block (4 * i), cut_message ("Wrong first block number for block %d", i)); + cut_assert_equal_int (4 * i + 3, mifare_classic_last_sector_block (4 * i + j), cut_message ("Wrong last block number for block %d", i)); + } + } + + for (int i=0; i < 8; i++) { + for (int j=0; j < 16; j++) { + cut_assert_equal_int (128 + 16 * i, mifare_classic_first_sector_block (128 + 16 * i), cut_message ("Wrong last block number for block %d", i)); + cut_assert_equal_int (128 + 16 * i + 15, mifare_classic_last_sector_block (128 + 16 * i + j), cut_message ("Wrong last block number for block %d", i)); + } + } +} +