[Genabel-commits] r1362 - in pkg/filevector: . tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Nov 6 15:50:14 CET 2013
Author: lckarssen
Date: 2013-11-06 15:50:14 +0100 (Wed, 06 Nov 2013)
New Revision: 1362
Modified:
pkg/filevector/Makefile
pkg/filevector/tests/ConvertTest.cpp
pkg/filevector/tests/CorrectnessTest.cpp
pkg/filevector/tests/TestUtil.cpp
pkg/filevector/tests/UnitTest.cpp
Log:
Several fixes in filevector so that 'make tests' compiles without warnings.
All tests finish OK.
- Makefile: I had to move -lcppunit to a different location in the g++ command line. Apparently newer versions of g++ are picky about this [1]
- Other files: mostly fixing comparisons between int and unsigned int
[1] http://forums.linuxmint.com/viewtopic.php?f=47&t=97717#p557810
Modified: pkg/filevector/Makefile
===================================================================
--- pkg/filevector/Makefile 2013-11-06 13:19:49 UTC (rev 1361)
+++ pkg/filevector/Makefile 2013-11-06 14:50:14 UTC (rev 1362)
@@ -29,7 +29,7 @@
# use for Solaris
# CPP = CC
-CFLAGS = -I $(LIBDIR) -I $(SRCDIR) -g -Wall -std=c++11 #-m64
+CFLAGS = -I $(LIBDIR) -I $(SRCDIR) -g -Wall -std=c++11 #-m64
CPPUNITFLAGS = -lcppunit
EXECS = $(TEXT2FVF) $(MERGEVARS) ${CONVERT}
@@ -57,13 +57,13 @@
DatABELdis: clean
cd ..; tar chvf DatABEL_$(VERSION).tar DatABEL_$(VERSION); gzip DatABEL_$(VERSION).tar
-clean:
+clean: tests-clean
rm -rf $(BINDIR)/* $(SRCDIR)/*.o $(LIBDIR)/*.o
correctnesstest : $(CORRECTNESSTEST)
$(CORRECTNESSTEST): $(LIBFILES) $(TESTFILES) $(TESTSDIR)/*.cpp $(TESTSDIR)/*.h
- $(CPP) $(CFLAGS) ${CPPUNITFLAGS} $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(TESTSDIR)/CorrectnessTest.cpp ${TESTSDIR}/TestUtil.cpp -o $(CORRECTNESSTEST); $(CORRECTNESSTEST)
+ $(CPP) $(CFLAGS) $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(TESTSDIR)/CorrectnessTest.cpp ${TESTSDIR}/TestUtil.cpp ${CPPUNITFLAGS} -o $(CORRECTNESSTEST); $(CORRECTNESSTEST)
readspeed : $(READSPEED)
$(READSPEED): $(LIBFILES) $(TESTFILES) $(TESTSDIR)/ReadSpeed.cpp
@@ -71,23 +71,23 @@
modificationtest : $(MODIFTEST)
$(MODIFTEST): $(LIBFILES) $(TESTFILES) $(TESTSDIR)/FileModificationTest.*
- $(CPP) $(CFLAGS) $(CPPUNITFLAGS) $(SRCDIR)/text2fvf.cpp $(LIBDIR)/*.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/FileModificationTest.cpp -o $(MODIFTEST); $(MODIFTEST)
+ $(CPP) $(CFLAGS) $(SRCDIR)/text2fvf.cpp $(LIBDIR)/*.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/FileModificationTest.cpp $(CPPUNITFLAGS) -o $(MODIFTEST); $(MODIFTEST)
unittest : $(UNITTEST)
$(UNITTEST): $(LIBFILES) $(TESTFILES) $(TESTSDIR)/TestUtil.* $(TESTSDIR)/UnitTest.*
- $(CPP) $(CFLAGS) $(CPPUNITFLAGS) $(SRCDIR)/text2fvf.cpp $(LIBDIR)/*.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/UnitTest.cpp -o $(UNITTEST); $(UNITTEST)
+ $(CPP) $(CFLAGS) $(SRCDIR)/text2fvf.cpp $(LIBDIR)/*.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/UnitTest.cpp $(CPPUNITFLAGS) -o $(UNITTEST); $(UNITTEST)
transposetest: $(TRANSPOSETEST)
$(TRANSPOSETEST): $(LIBFILES) $(TESTFILES) $(TESTSDIR)/TransposeTest.cpp
- $(CPP) $(CFLAGS) $(CPPUNITFLAGS) $(SRCDIR)/text2fvf.cpp $(LIBDIR)/*.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/TransposeTest.cpp -o $(TRANSPOSETEST); $(TRANSPOSETEST)
+ $(CPP) $(CFLAGS) $(SRCDIR)/text2fvf.cpp $(LIBDIR)/*.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/TransposeTest.cpp $(CPPUNITFLAGS) -o $(TRANSPOSETEST); $(TRANSPOSETEST)
rfhtest: $(RFHTEST)
$(RFHTEST): $(LIBFILES) $(TESTFILES) $(TESTSDIR)/ReusableFileHandleTest.cpp
- $(CPP) $(CFLAGS) $(CPPUNITFLAGS) $(LIBDIR)/*.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/ReusableFileHandleTest.cpp -o $(RFHTEST); $(RFHTEST)
+ $(CPP) $(CFLAGS) $(LIBDIR)/*.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/ReusableFileHandleTest.cpp $(CPPUNITFLAGS) -o $(RFHTEST); $(RFHTEST)
converter : $(CONVERT)
$(CONVERT): $(LIBFILES) $(SRCDIR)/convert.cpp
- $(CPP) $(CFLAGS) $(CPPUNITFLAGS) $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(SRCDIR)/convert.cpp -o $(CONVERT)
+ $(CPP) $(CFLAGS) $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(SRCDIR)/convert.cpp $(CPPUNITFLAGS) -o $(CONVERT)
transpose :$(TRANSPOSE)
$(TRANSPOSE) : $(LIBFILES) $(SRCDIR)/transpose_main.cpp
@@ -96,19 +96,19 @@
writespeed : $(WRITE_VAR_SPEED)
$(WRITE_VAR_SPEED): $(LIBFILES) $(SRCDIR)/convert.cpp
- $(CPP) $(CFLAGS) $(CPPUNITFLAGS) $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(TESTSDIR)/WriteVariablesSpeed.cpp -o $(WRITE_VAR_SPEED)
+ $(CPP) $(CFLAGS) $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(TESTSDIR)/WriteVariablesSpeed.cpp $(CPPUNITFLAGS) -o $(WRITE_VAR_SPEED)
accessmodetest : $(ACCESSMODETEST)
$(ACCESSMODETEST): $(LIBFILES) $(TESTFILES) $(TESTSDIR)/AccessModeTest.cpp
- $(CPP) $(CFLAGS) $(CPPUNITFLAGS) $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/AccessModeTest.cpp -o $(ACCESSMODETEST); $(ACCESSMODETEST)
+ $(CPP) $(CFLAGS) $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/AccessModeTest.cpp $(CPPUNITFLAGS) -o $(ACCESSMODETEST); $(ACCESSMODETEST)
converttest : $(CONVERTTEST)
$(CONVERTTEST):$(LIBFILES) $(TESTFILES) $(TESTSDIR)/ConvertTest.cpp
- $(CPP) $(CFLAGS) $(CPPUNITFLAGS) $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/ConvertTest.cpp -o $(CONVERTTEST); $(CONVERTTEST)
-
+ $(CPP) $(CFLAGS) $(LIBDIR)/*.cpp $(SRCDIR)/text2fvf.cpp $(TESTSDIR)/TestUtil.cpp $(TESTSDIR)/ConvertTest.cpp $(CPPUNITFLAGS) -o $(CONVERTTEST); $(CONVERTTEST)
+
buildtestdata : $(BUILDTESTDATA)
$(BUILDTESTDATA):$(TESTSDIR)/BuildTestData.cpp $(LIBDIR)/*.cpp $(LIBDIR)/*.h
- $(CPP) $(CFLAGS) $(CPPUNITFLAGS) $(TESTSDIR)/BuildTestData.cpp $(LIBDIR)/*.cpp -o $(BUILDTESTDATA)
+ $(CPP) $(CFLAGS) $(TESTSDIR)/BuildTestData.cpp $(LIBDIR)/*.cpp $(CPPUNITFLAGS) -o $(BUILDTESTDATA)
preparetestdata: buildtestdata
$(BUILDTESTDATA) tests/data/correctnessTestData 33815 1473 100 120; $(BUILDTESTDATA) tests/data/2write/modify_me 1001 1003;
@@ -116,4 +116,5 @@
tests : preparetestdata correctnesstest readspeed modificationtest unittest writespeed accessmodetest converttest transposetest
runtests : tests
-
+tests-clean:
+ rm -rf tests/data/2write/* tests/data/modetests/* tests/data/correctnessTestData.*
Modified: pkg/filevector/tests/ConvertTest.cpp
===================================================================
--- pkg/filevector/tests/ConvertTest.cpp 2013-11-06 13:19:49 UTC (rev 1361)
+++ pkg/filevector/tests/ConvertTest.cpp 2013-11-06 14:50:14 UTC (rev 1362)
@@ -25,7 +25,7 @@
float * var = new float [fv->getNumObservations()];
- for(int i = 0; i< fv->getNumObservations(); i++) {
+ for(unsigned int i = 0; i< fv->getNumObservations(); i++) {
var[i] = i + 1.1;
}
@@ -70,4 +70,4 @@
runner.addTest( ConvertTest::suite() );
runner.run();
return 0;
-}
\ No newline at end of file
+}
Modified: pkg/filevector/tests/CorrectnessTest.cpp
===================================================================
--- pkg/filevector/tests/CorrectnessTest.cpp 2013-11-06 13:19:49 UTC (rev 1361)
+++ pkg/filevector/tests/CorrectnessTest.cpp 2013-11-06 14:50:14 UTC (rev 1362)
@@ -76,13 +76,13 @@
testDbg << "Size is " << numVariables << " x " << numObservations << endl;
- int numObservationsToTest = 10;
+ unsigned long numObservationsToTest = 10;
int observationIdx[numObservationsToTest];
unsigned long i;
TestUtil::initRandomGenerator();
- for (int i=0; i<numObservationsToTest; i++) {
+ for (i=0; i<numObservationsToTest; i++) {
observationIdx[i] = (rand()*numObservations)/RAND_MAX;
}
Modified: pkg/filevector/tests/TestUtil.cpp
===================================================================
--- pkg/filevector/tests/TestUtil.cpp 2013-11-06 13:19:49 UTC (rev 1361)
+++ pkg/filevector/tests/TestUtil.cpp 2013-11-06 14:50:14 UTC (rev 1362)
@@ -38,7 +38,7 @@
void TestUtil::create_and_fill_variable(unsigned int nobs, float * in ) {
- for(int i = 0; i<nobs; i++)
+ for(unsigned int i = 0; i<nobs; i++)
{
in[i] = i + (float)i/10;
}
Modified: pkg/filevector/tests/UnitTest.cpp
===================================================================
--- pkg/filevector/tests/UnitTest.cpp 2013-11-06 13:19:49 UTC (rev 1361)
+++ pkg/filevector/tests/UnitTest.cpp 2013-11-06 14:50:14 UTC (rev 1362)
@@ -245,8 +245,8 @@
float * var1 = new float [fv->getNumVariables()];
float * var2 = new float [fv->getNumVariables()];
- int i;
- for(i = 0; i<fv->getNumVariables(); i++)
+
+ for(unsigned int i = 0; i<fv->getNumVariables(); i++)
{
var1[i] = i;
}
@@ -278,7 +278,7 @@
AbstractMatrix* fv = new FileVector( tmp_file_name, 1 );
float * var = new float [fv->getNumObservations()];
- for(int i = 0; i<fv->getNumObservations(); i++)
+ for(unsigned int i = 0; i<fv->getNumObservations(); i++)
{
var[i] = i + (float)i/10;
}
More information about the Genabel-commits
mailing list