Move test_mifare_classic_sector_boundaries() in it's own file.
While here, sort out lines in test/Makefile.am.
This commit is contained in:
parent
d5b91f9f3a
commit
5a7a9391ae
3 changed files with 50 additions and 23 deletions
|
@ -14,8 +14,9 @@ TESTS_ENVIRONMENT = NO_MAKE=yes CUTTER="$(CUTTER)"
|
||||||
noinst_LTLIBRARIES = \
|
noinst_LTLIBRARIES = \
|
||||||
test_mad.la \
|
test_mad.la \
|
||||||
test_mifare_classic.la \
|
test_mifare_classic.la \
|
||||||
test_mifare_classic_create_trailer_block.la \
|
|
||||||
test_mifare_classic_application.la \
|
test_mifare_classic_application.la \
|
||||||
|
test_mifare_classic_create_trailer_block.la \
|
||||||
|
test_mifare_classic_sector_boundaries.la \
|
||||||
test_mifare_ultralight.la \
|
test_mifare_ultralight.la \
|
||||||
test_tlv.la
|
test_tlv.la
|
||||||
|
|
||||||
|
@ -29,12 +30,15 @@ test_mifare_classic_la_SOURCES = test_mifare_classic.c \
|
||||||
mifare_classic_fixture.h
|
mifare_classic_fixture.h
|
||||||
test_mifare_classic_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la
|
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_SOURCES = test_mifare_classic_application.c
|
||||||
test_mifare_classic_application_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la
|
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 \
|
test_mifare_ultralight_la_SOURCES = test_mifare_ultralight.c \
|
||||||
mifare_ultralight_fixture.c \
|
mifare_ultralight_fixture.c \
|
||||||
mifare_ultralight_fixture.h
|
mifare_ultralight_fixture.h
|
||||||
|
|
|
@ -339,22 +339,3 @@ test_mifare_classic_get_uid (void)
|
||||||
free (uid);
|
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
42
test/test_mifare_classic_sector_boundaries.c
Normal file
42
test/test_mifare_classic_sector_boundaries.c
Normal file
|
@ -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 <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cutter.h>
|
||||||
|
|
||||||
|
#include <freefare.h>
|
||||||
|
#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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue