Update of /cvsroot/boost/boost/libs/gil/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29844/boost/libs/gil/test
Modified Files:
Jamfile Jamfile.v2 image.cpp main.cpp
Log Message:
Hooked up GIL regression tests to run from boost/status
Added kth_channel_view (like nth_channel_view but operates on heterogeneous
views)
Index: Jamfile
===================================================================
RCS file: /cvsroot/boost/boost/libs/gil/test/Jamfile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Jamfile 7 May 2007 07:33:32 -0000 1.2
+++ Jamfile 10 May 2007 22:39:02 -0000 1.3
@@ -1,16 +1,18 @@
# Jamfile for building the GIL test app
-subproject libs/gil/test
- ;
+subproject libs/gil/test ;
-exe gil_test :
- main.cpp
- image.cpp
- image_io.cpp
- pixel.cpp
- pixel_iterator.cpp
- channel.cpp
- sample_image.cpp
- : <include>$(BOOST_ROOT) <define>BOOST_GIL_NO_IO
-;
+import testing ;
+test-suite gil :
+ [ run main.cpp
+ image.cpp
+ image_io.cpp
+ pixel.cpp
+ pixel_iterator.cpp
+ channel.cpp
+ sample_image.cpp
+ :
+ :
+ : <include>$(BOOST_ROOT) <define>BOOST_GIL_NO_IO ]
+;
Index: Jamfile.v2
===================================================================
RCS file: /cvsroot/boost/boost/libs/gil/test/Jamfile.v2,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Jamfile.v2 24 Apr 2007 01:58:42 -0000 1.1
+++ Jamfile.v2 10 May 2007 22:39:02 -0000 1.2
@@ -1,16 +1,18 @@
# Jamfile for building the GIL test app
-project libs/gil/test
- ;
+project libs/gil/test ;
-exe gil_test :
- main.cpp
- image.cpp
- image_io.cpp
- pixel.cpp
- pixel_iterator.cpp
- channel.cpp
- sample_image.cpp
- : <include>$(BOOST_ROOT) <define>BOOST_GIL_NO_IO
-;
+import testing ;
+test-suite gil :
+ [ run main.cpp
+ image.cpp
+ image_io.cpp
+ pixel.cpp
+ pixel_iterator.cpp
+ channel.cpp
+ sample_image.cpp
+ :
+ :
+ : <include>$(BOOST_ROOT) <define>BOOST_GIL_NO_IO ]
+;
Index: image.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/gil/test/image.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- image.cpp 7 May 2007 07:33:33 -0000 1.2
+++ image.cpp 10 May 2007 22:39:02 -0000 1.3
@@ -247,6 +247,7 @@
check_view(flipped_left_right_view(img_view),prefix+"flipped_lr");
check_view(subsampled_view(img_view,typename
View::point_t(2,1)),prefix+"subsampled");
check_view(nth_channel_view(img_view,0),prefix+"0th_channel");
+ check_view(kth_channel_view<0>(img_view),prefix+"0th_channel");
}
@@ -350,11 +351,8 @@
protected:
typedef map<string,boost::crc_32_type::value_type> crc_map_t;
crc_map_t _crc_map;
- static const string _checksum_ref_file;
};
-const string
checksum_image_mgr::_checksum_ref_file="gil_reference_checksums.txt";
-
////////////////////////////////////////////////////
///
/// Performs image tests by comparing image pixel checksums against a
reference
@@ -362,7 +360,10 @@
////////////////////////////////////////////////////
class checksum_image_test : public checksum_image_mgr {
+public:
+ checksum_image_test(const char* filename) : _filename(filename) {}
private:
+ const char* _filename;
virtual void initialize();
virtual void check_view_impl(const rgb8c_view_t& v, const string& name);
};
@@ -371,7 +372,7 @@
void checksum_image_test::initialize() {
string crc_name;
boost::crc_32_type::value_type crc_result;
- fstream checksum_ref(_checksum_ref_file.c_str(),ios::in);
+ fstream checksum_ref(_filename,ios::in);
while (true) {
checksum_ref >> crc_name >> std::hex >> crc_result;
if(checksum_ref.fail()) break;
@@ -399,7 +400,10 @@
////////////////////////////////////////////////////
class checksum_image_generate : public checksum_image_mgr {
+public:
+ checksum_image_generate(const char* filename) : _filename(filename) {}
private:
+ const char* _filename;
virtual void check_view_impl(const rgb8c_view_t& img_view, const string&
name);
virtual void finalize();
};
@@ -414,7 +418,7 @@
// Save the checksums into the reference file
void checksum_image_generate::finalize() {
- fstream checksum_ref(_checksum_ref_file.c_str(),ios::out);
+ fstream checksum_ref(_filename,ios::out);
for (crc_map_t::const_iterator it=_crc_map.begin(); it!=_crc_map.end();
++it) {
checksum_ref << it->first << " " << std::hex << it->second << "\r\n";
}
@@ -440,12 +444,11 @@
#include <boost/gil/extension/io/jpeg_io.hpp>
-class file_image_mgr : public image_test {
-protected:
- static const string _checksum_ref_file;
-};
+class file_image_mgr : public image_test {};
class file_image_test : public file_image_mgr {
+public:
+ file_image_test(const char*) {}
protected:
void check_view_impl(const boost::gil::rgb8c_view_t& img_view,const
string& name) {
jpeg_write_view(out_dir+name+".jpg",img_view);
@@ -462,6 +465,8 @@
};
class file_image_generate : public file_image_mgr {
+public:
+ file_image_generate(const char*) {}
protected:
void check_view_impl(const boost::gil::rgb8c_view_t& img_view,const
string& name) {
jpeg_write_view(ref_dir+name+".jpg",img_view);
@@ -516,8 +521,8 @@
#endif
-void test_image() {
- image_mgr_t mgr;
+void test_image(const char* ref_checksum) {
+ image_mgr_t mgr(ref_checksum);
mgr.run();
static_checks();
Index: main.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/gil/test/main.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- main.cpp 7 May 2007 07:33:33 -0000 1.2
+++ main.cpp 10 May 2007 22:39:02 -0000 1.3
@@ -10,18 +10,37 @@
// main.cpp : Runs all GIL tests.
//
+#include <fstream>
+#include <iostream>
+
void test_channel();
void test_pixel();
void test_pixel_iterator();
-void test_image();
+void test_image(const char*);
void test_image_io();
void test_gimage();
-int main(int argc, unsigned char* argv[]) {
+int main(int argc, char* argv[]) {
test_pixel();
test_channel();
test_pixel_iterator();
test_image_io();
- test_image();
+
+ const char* local_name = "gil_reference_checksums.txt";
+ const char* name_from_status =
"../libs/gil/test/gil_reference_checksums.txt";
+
+ std::ifstream file_is_there(local_name);
+ if (file_is_there) {
+ test_image(local_name);
+ } else {
+ std::ifstream file_is_there(name_from_status);
+ if (file_is_there)
+ test_image(name_from_status);
+ else {
+ std::cerr << "Unable to open
gil_reference_checksums.txt"<<std::endl;
+ return 1;
+ }
+ }
+
return 0;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs