[GRASS-SVN] r53697 - grass/trunk/lib/cdhc

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 6 05:02:17 PST 2012


Author: neteler
Date: 2012-11-06 05:02:16 -0800 (Tue, 06 Nov 2012)
New Revision: 53697

Added:
   grass/trunk/lib/cdhc/test.c
   grass/trunk/lib/cdhc/test_numbers.csv
Removed:
   grass/trunk/lib/cdhc/c-drive.c.txt
Modified:
   grass/trunk/lib/cdhc/Makefile
Log:
activated automated test

Modified: grass/trunk/lib/cdhc/Makefile
===================================================================
--- grass/trunk/lib/cdhc/Makefile	2012-11-06 12:55:09 UTC (rev 53696)
+++ grass/trunk/lib/cdhc/Makefile	2012-11-06 13:02:16 UTC (rev 53697)
@@ -1,7 +1,24 @@
 MODULE_TOPDIR = ../..
 
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+
+MOD_OBJS := $(filter-out test.o port_test.o,$(AUTO_OBJS))
+
 LIB = CDHC
 
 include $(MODULE_TOPDIR)/include/Make/Lib.make
 
 default: lib
+	@echo "==============TEST============="
+ifeq ($(strip $(CROSS_COMPILING)),)
+	$(MAKE) test
+endif
+
+test: $(OBJDIR)/test$(EXE)
+	cd $(OBJDIR) && $(call run_grass,./test < ../test_numbers.csv)
+
+#  Test functions
+$(OBJDIR)/test$(EXE): $(OBJDIR)/test.o $(CDHCDEP)
+	$(call linker)
+
+$(OBJDIR)/test$(EXE): LIBES = $(CDHCLIB)

Deleted: grass/trunk/lib/cdhc/c-drive.c.txt
===================================================================
--- grass/trunk/lib/cdhc/c-drive.c.txt	2012-11-06 12:55:09 UTC (rev 53696)
+++ grass/trunk/lib/cdhc/c-drive.c.txt	2012-11-06 13:02:16 UTC (rev 53697)
@@ -1,48 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <grass/cdhc.h>
-
-
-int main(int argc, char **argv)
-{
-    double x[1000];
-    double *y;
-    int n = 0;
-
-    while (scanf("%lf", &x[n++]) != EOF) ;
-    n--;
-
-    fprintf(stdout, "N=%d\n", n);
-    fprintf(stdout, "*y=%ld\n", y);
-    y = omnibus_moments(x, n);
-    fprintf(stdout, "*y=%ld\n", y);
-    y = geary_test(x, n);
-    fprintf(stdout, "*y=%ld\n", y);
-    y = dagostino_d(x, n);
-    fprintf(stdout, "y=%g\n", y[1]);
-    y = kuipers_v(x, n);
-    y = watson_u2(x, n);
-    y = durbins_exact(x, n);
-    y = anderson_darling(x, n);
-    y = cramer_von_mises(x, n);
-
-    /* for ks and lillefors, the discrepancy seems to come
-       in in computing the sum of x*x */
-
-    y = kolmogorov_smirnov(x, n);
-    y = chi_square(x, n);
-    y = shapiro_wilk(x, n);
-    y = shapiro_francia(x, n);
-    y = shapiro_wilk_exp(x, n);
-    y = cramer_von_mises_exp(x, n);
-    y = kolmogorov_smirnov_exp(x, n);
-    y = kuipers_v_exp(x, n);
-    y = watson_u2_exp(x, n);
-    y = anderson_darling_exp(x, n);
-    y = chi_square_exp(x, n);
-    y = mod_maxlik_ratio(x, n);
-    y = coeff_variation(x, n);
-    y = kotz_families(x, n);
-
-    return EXIT_SUCCESS;
-}

Copied: grass/trunk/lib/cdhc/test.c (from rev 53692, grass/trunk/lib/cdhc/c-drive.c.txt)
===================================================================
--- grass/trunk/lib/cdhc/test.c	                        (rev 0)
+++ grass/trunk/lib/cdhc/test.c	2012-11-06 13:02:16 UTC (rev 53697)
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <grass/cdhc.h>
+
+
+int main(int argc, char **argv)
+{
+    double x[1000];
+    double *y;
+    int n = 0;
+
+    while (scanf("%lf", &x[n++]) != EOF) ;
+    n--;
+
+    fprintf(stdout, "N=%d\n", n);
+    fprintf(stdout, "*y=%ld\n", y);
+    y = omnibus_moments(x, n);
+    fprintf(stdout, "*y=%ld\n", y);
+    y = geary_test(x, n);
+    fprintf(stdout, "*y=%ld\n", y);
+    y = dagostino_d(x, n);
+    fprintf(stdout, "y=%g\n", y[1]);
+    y = kuipers_v(x, n);
+    y = watson_u2(x, n);
+    y = durbins_exact(x, n);
+    y = anderson_darling(x, n);
+    y = cramer_von_mises(x, n);
+
+    /* for ks and lillefors, the discrepancy seems to come
+       in in computing the sum of x*x */
+
+    y = kolmogorov_smirnov(x, n);
+    y = chi_square(x, n);
+    y = shapiro_wilk(x, n);
+    y = shapiro_francia(x, n);
+    y = shapiro_wilk_exp(x, n);
+    y = cramer_von_mises_exp(x, n);
+    y = kolmogorov_smirnov_exp(x, n);
+    y = kuipers_v_exp(x, n);
+    y = watson_u2_exp(x, n);
+    y = anderson_darling_exp(x, n);
+    y = chi_square_exp(x, n);
+
+/* missing from source code:
+    y = mod_maxlik_ratio(x, n);
+    y = coeff_variation(x, n);
+*/
+    y = kotz_families(x, n);
+
+    return EXIT_SUCCESS;
+}

Added: grass/trunk/lib/cdhc/test_numbers.csv
===================================================================
--- grass/trunk/lib/cdhc/test_numbers.csv	                        (rev 0)
+++ grass/trunk/lib/cdhc/test_numbers.csv	2012-11-06 13:02:16 UTC (rev 53697)
@@ -0,0 +1,7 @@
+1234.2
+3454
+23423
+234
+23423
+3678
+67873.5



More information about the grass-commit mailing list