aboutsummaryrefslogtreecommitdiff
path: root/tests/symmetry_check.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-07-20 18:57:30 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:33 +0100
commitc1103a3d7f0cdbc06f74c46fdcc02b06264aeb5e (patch)
tree504d18c9f4f975d525a9c692563c49d9e778c2dd /tests/symmetry_check.c
parentb143429764665a75dd3baf8c5115bf8553d18d71 (diff)
Make generation work (hopefully) and add unit test
Diffstat (limited to 'tests/symmetry_check.c')
-rw-r--r--tests/symmetry_check.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/symmetry_check.c b/tests/symmetry_check.c
new file mode 100644
index 00000000..bda6961e
--- /dev/null
+++ b/tests/symmetry_check.c
@@ -0,0 +1,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;
+}