Boost logo

Boost-Commit :

From: ghost_at_[hidden]
Date: 2007-10-26 15:37:56


Author: vladimir_prus
Date: 2007-10-26 15:37:56 EDT (Fri, 26 Oct 2007)
New Revision: 40487
URL: http://svn.boost.org/trac/boost/changeset/40487

Log:
Fix winmain test
Text files modified:
   trunk/libs/program_options/test/winmain.cpp | 30 +++++++++++++++++++++++-------
   1 files changed, 23 insertions(+), 7 deletions(-)

Modified: trunk/libs/program_options/test/winmain.cpp
==============================================================================
--- trunk/libs/program_options/test/winmain.cpp (original)
+++ trunk/libs/program_options/test/winmain.cpp 2007-10-26 15:37:56 EDT (Fri, 26 Oct 2007)
@@ -7,26 +7,42 @@
 #include <string>
 #include <vector>
 #include <cctype>
+#include <iostream>
+#include <stdlib.h>
+
+using namespace std;
 
 #include <boost/program_options/parsers.hpp>
 using namespace boost::program_options;
 
-#include <boost/test/test_tools.hpp>
+void check_equal(const std::vector<string>& actual, char **expected, int n)
+{
+ if (actual.size() != n)
+ {
+ std::cerr << "Size mismatch between expected and actual data\n";
+ abort();
+ }
+ for (int i = 0; i < n; ++i)
+ {
+ if (actual[i] != expected[i])
+ {
+ std::cerr << "Unexpected content\n";
+ abort();
+ }
+ }
+}
+
 #include <boost/preprocessor/cat.hpp>
 
 void test_winmain()
 {
- using namespace std;
 
 #define C ,
 #define TEST(input, expected) \
     char* BOOST_PP_CAT(e, __LINE__)[] = expected;\
     vector<string> BOOST_PP_CAT(v, __LINE__) = split_winmain(input);\
- BOOST_CHECK_EQUAL_COLLECTIONS(BOOST_PP_CAT(v, __LINE__).begin(),\
- BOOST_PP_CAT(v, __LINE__).end(),\
- BOOST_PP_CAT(e, __LINE__),\
- BOOST_PP_CAT(e, __LINE__) + \
- sizeof(BOOST_PP_CAT(e, __LINE__))/sizeof(char*));
+ check_equal(BOOST_PP_CAT(v, __LINE__), BOOST_PP_CAT(e, __LINE__),\
+ sizeof(BOOST_PP_CAT(e, __LINE__))/sizeof(char*));
 
 // The following expectations were obtained in Win2000 shell:
     TEST("1 ", {"1"});


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk