From 93f5d444a533651154a7cf507f02c1eb40fad087 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 20 Jul 2011 19:08:33 +0200 Subject: More PG checking --- tests/symmetry_check.c | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'tests/symmetry_check.c') diff --git a/tests/symmetry_check.c b/tests/symmetry_check.c index bda6961e..b3d4cb34 100644 --- a/tests/symmetry_check.c +++ b/tests/symmetry_check.c @@ -22,10 +22,20 @@ #include "../src/utils.h" -static void check_nequiv(const char *pg, int answer, int *fail) +static const char *maybenot(int v) +{ + if ( v ) { + return ""; + } else { + return " not"; + } +} + + +static void check_pg_props(const char *pg, int answer, int centro, int *fail) { SymOpList *sym; - int n; + int n, c; //STATUS("**************************************** Testing '%s'\n", pg); @@ -33,11 +43,18 @@ static void check_nequiv(const char *pg, int answer, int *fail) n = num_equivs(sym, NULL); if ( n != answer ) { - ERROR("Number of equivalents in '%s' is %i (not %i)\n", + ERROR("Number of equivalents in '%s' is %i (not %i).\n", pg, n, answer); *fail = 1; } + c = is_centrosymmetric(sym); + if ( c != centro ) { + ERROR("'%s' should%s be centrosymmetric, but is%s.\n", + pg, maybenot(centro), maybenot(c)); + *fail = 1; + } + free_symoplist(sym); } @@ -46,11 +63,18 @@ int main(int argc, char *argv[]) { int fail = 0; - check_nequiv( "1", 1, &fail); - check_nequiv( "-1", 2, &fail); - check_nequiv( "2", 2, &fail); - check_nequiv( "m", 2, &fail); - check_nequiv("2/m", 4, &fail); + check_pg_props( "1", 1, 0, &fail); + check_pg_props( "-1", 2, 1, &fail); + + check_pg_props( "2", 2, 0, &fail); + check_pg_props( "m", 2, 0, &fail); + check_pg_props("2/m", 4, 1, &fail); + + check_pg_props("222", 4, 0, &fail); + check_pg_props("mm2", 4, 0, &fail); + check_pg_props("mmm", 8, 1, &fail); + + check_pg_props( "4", 4, 0, &fail); return fail; } -- cgit v1.2.3