aboutsummaryrefslogtreecommitdiff
path: root/tests
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
parentb143429764665a75dd3baf8c5115bf8553d18d71 (diff)
Make generation work (hopefully) and add unit test
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/symmetry_check.c56
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 898fcd89..c2a45f5a 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -4,4 +4,5 @@ list_check
gpu_sim_check
integration_check
pr_gradient_check
+symmetry_check
.dirstamp
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;
+}