aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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;
+}