changeset 9163:4e09c917c68d octave-forge

skeleton testing code. from src dir: make test
author blondandy
date Fri, 09 Dec 2011 21:35:20 +0000
parents 0b106f24d031
children 3545add292a1
files extra/dicom/mkpkg.sh extra/dicom/src/Makefile extra/dicom/src/dicomdict.cpp extra/dicom/src/dicominfo.cpp extra/dicom/src/dicomlookup.cpp extra/dicom/src/dicomread.cpp
diffstat 6 files changed, 45 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/extra/dicom/mkpkg.sh	Fri Dec 09 21:28:04 2011 +0000
+++ b/extra/dicom/mkpkg.sh	Fri Dec 09 21:35:20 2011 +0000
@@ -9,7 +9,8 @@
 VLINE=$(cat ~/$PKG/DESCRIPTION | grep Version:)
 PKG_VERSION=${VLINE#* }
 ARCHNAME=$PKG-$PKG_VERSION.tar.gz
-rm ~/dicom/mkpkg.sh
+rm    ~/dicom/mkpkg.sh
+rm -r ~/dicom/dcm_examples
 echo "Version=$PKG_VERSION"
 cd ~
 tar czf $ARCHNAME $PKG/
--- a/extra/dicom/src/Makefile	Fri Dec 09 21:28:04 2011 +0000
+++ b/extra/dicom/src/Makefile	Fri Dec 09 21:35:20 2011 +0000
@@ -61,3 +61,17 @@
 
 clean:
 	rm -f *.o *.oct *~
+
+test: all test_dicominfo test_dicomdict test_dicomread test_dicomlookup
+	
+test_dicominfo: 
+	octave -q --eval "test dicominfo.cpp"
+
+test_dicomdict: 
+	octave -q --eval "test dicomdict.cpp"
+
+test_dicomread: 
+	octave -q --eval "test dicomread.cpp"
+
+test_dicomlookup: 
+	octave -q --eval "test dicomlookup.cpp"
\ No newline at end of file
--- a/extra/dicom/src/dicomdict.cpp	Fri Dec 09 21:28:04 2011 +0000
+++ b/extra/dicom/src/dicomdict.cpp	Fri Dec 09 21:35:20 2011 +0000
@@ -354,3 +354,9 @@
 	if (0==tagmap.size()) load_dict(factory_dicom_dict_filename); // init if necessary
 	return tagmap.count(tag)>(std::vector<gdcm::Tag>::size_type)0 ;
 }
+
+/*
+%!test
+%! addpath('../inst'); % so it can find the dictionary
+%! % todo
+*/
\ No newline at end of file
--- a/extra/dicom/src/dicominfo.cpp	Fri Dec 09 21:28:04 2011 +0000
+++ b/extra/dicom/src/dicominfo.cpp	Fri Dec 09 21:35:20 2011 +0000
@@ -563,3 +563,15 @@
 	*tl = '\0';
 	return d;
 }
+
+/*
+%!test
+%! addpath('../inst'); % so it can find the dictionary
+%! dcmfile="../dcm_examples/RD.15MV.DCM";
+%! s=dicominfo(dcmfile);
+%! if ~strcmp(s.PatientName,"PHANTOM^IsodoseComparison^^^")
+%!   error("name read incorrectly: %s",s.PatientName);
+%! else
+%!   printf("name read OK: %s %s\n",dcmfile, s.PatientName);
+%! end
+*/
\ No newline at end of file
--- a/extra/dicom/src/dicomlookup.cpp	Fri Dec 09 21:28:04 2011 +0000
+++ b/extra/dicom/src/dicomlookup.cpp	Fri Dec 09 21:35:20 2011 +0000
@@ -72,3 +72,9 @@
 	error(QUOTED(OCT_FN_NAME_LU)": takes 1 or 2 arguments, got %i. see help",args.length ());
 	return retval;
 }
+
+/*
+%!test
+%! addpath('../inst'); % so it can find the dictionary
+%! % todo
+*/
\ No newline at end of file
--- a/extra/dicom/src/dicomread.cpp	Fri Dec 09 21:28:04 2011 +0000
+++ b/extra/dicom/src/dicomread.cpp	Fri Dec 09 21:35:20 2011 +0000
@@ -155,4 +155,8 @@
 	
 }
 
-
+/*
+%!test
+%! addpath('../inst'); % so it can find the dictionary
+%! % todo
+*/