[Kst] extragear/graphics/kst/tests

Ted Kisner tskisner.public at gmail.com
Fri Nov 4 22:42:23 CET 2005


SVN commit 477733 by tskisner:

Have healpix testcase check for its calling path in order to set the path to the example data file.  Add testcase to the runregression script.

 M  +19 -12    healpix/testhealpix.cpp  
 M  +1 -1      runregression.sh  


--- trunk/extragear/graphics/kst/tests/healpix/testhealpix.cpp #477732:477733
@@ -7,6 +7,8 @@
 #include <healpix_source.h>
 #include <ksdebug.h>
 
+QString myName;
+
 static void exitHelper() {
   KST::vectorList.clear();
   KST::scalarList.clear();
@@ -38,8 +40,12 @@
 }
 
 void doTests() {
-  // the data file to use
-  QString datafile = "healpix_example_sm.fits";
+  // the data file to use.
+  // first determine the path used to call this program, and then prepend
+  // that to the data file name.
+  QString path = myName.section('/', 0, -3);
+  QString datafile = path;
+  datafile.append("/healpix_example_sm.fits");
   
   // create a temporary config file to use
   QString cfgfile = "testhealpix.temp";
@@ -66,27 +72,27 @@
   // use the C functions to test for healpix support
   int verstehen = understands_healpix(cfg, datafile);
   if (verstehen) {
-    kstdDebug() << "HEALPIX:  data file " << datafile << " is supported" << endl;
+    kstdDebug() << "data file " << datafile << " is supported" << endl;
     QString suggestion;
     bool complete;
     QStringList fields = matrixList_healpix(cfg, datafile, "HEALPIX", &suggestion, &complete);
-    kstdDebug() << "HEALPIX:  available matrices are:" << endl;
+    kstdDebug() << "available matrices are:" << endl;
     for ( QStringList::Iterator it = fields.begin(); it != fields.end(); ++it ) {
-      kstdDebug() << "HEALPIX:    " << *it << endl;
+      kstdDebug() << "  " << *it << endl;
     }
-    kstdDebug() << "HEALPIX:    suggestion = " << suggestion << endl;
-    kstdDebug() << "HEALPIX:    complete = " << complete << endl;
+    kstdDebug() << "  suggestion = " << suggestion << endl;
+    kstdDebug() << "  complete = " << complete << endl;
     fields.clear();
     fields = fieldList_healpix(cfg, datafile, "HEALPIX", &suggestion, &complete);
-    kstdDebug() << "HEALPIX:  available fields are:" << endl;
+    kstdDebug() << "available fields are:" << endl;
     for ( QStringList::Iterator it = fields.begin(); it != fields.end(); ++it ) {
-      kstdDebug() << "HEALPIX:    " << *it << endl;
+      kstdDebug() << "  " << *it << endl;
     }
-    kstdDebug() << "HEALPIX:    suggestion = " << suggestion << endl;
-    kstdDebug() << "HEALPIX:    complete = " << complete << endl;
+    kstdDebug() << "  suggestion = " << suggestion << endl;
+    kstdDebug() << "  complete = " << complete << endl;
     
     // actually create HealpixSource
-    //HealpixSource *hpx = create_healpix(cfg, datafile, "HEALPIX");
+    HealpixSource *hpx = new HealpixSource(cfg, datafile, "HEALPIX");
     
   } else {
     testAssert(false, "understanding");
@@ -98,6 +104,7 @@
 int main(int argc, char **argv) {
   atexit(exitHelper);
 
+  myName = argv[0];
   KApplication app(argc, argv, "testhealpix", false, false);
 
   doTests();
--- trunk/extragear/graphics/kst/tests/runregression.sh #477732:477733
@@ -28,7 +28,7 @@
 	exit -1;
 fi
 
-TESTS="testeqparser testhistogram testscalars testlabelparser testrvector testvector"
+TESTS="testeqparser testhistogram testscalars testlabelparser testrvector testvector healpix/testhealpix"
 testeqparser_FILES="eparse.y escan.l eparse.c escan.c enodes.cpp enodefactory.cpp"
 testhistogram_FILES="ksthistogram.cpp"
 testscalars_FILES="kstscalar.cpp"


More information about the Kst mailing list