aboutsummaryrefslogtreecommitdiff
path: root/tests/symmetry_check.c
blob: bda6961e8fb9dcb7ba1d0a3201b5d9efef082a45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * symmetry_check.c
 *
 * Check symmetry
 *
 * (c) 2011 Thomas White <taw@physics.org>
 *
 * Part of CrystFEL - crystallography with a FEL
 *
 */


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#include <stdlib.h>
#include <stdio.h>

#include "../src/symmetry.h"
#include "../src/utils.h"


static void check_nequiv(const char *pg, int answer, int *fail)
{
	SymOpList *sym;
	int n;

	//STATUS("**************************************** Testing '%s'\n", pg);

	sym = get_pointgroup(pg);
	n = num_equivs(sym, NULL);

	if ( n != answer ) {
		ERROR("Number of equivalents in '%s' is %i (not %i)\n",
		      pg, n, answer);
		*fail = 1;
	}

	free_symoplist(sym);
}


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);

	return fail;
}