It seems that you are tryingto check floating point values for equality. It's never a good idea. Try to switch to the UTF and use BOOST_CHECK_CLOSE.
 
To switch you need to change
 
#include <boost/test/minimal.hpp>
 
int test_main(...)\
{
  ...
}
 
to
 
#include <boost/test/included/unit_test.hpp>
 
BOOST_AUTO_TEST_CASE( test_main )
{
   ...
}
 
Let me knwo if you still have any problems.
 
Gennadiy
"chun ping wang" <cablepuff@gmail.com> wrote in message news:7253f6b30705171041t12ba7adifc661be8c885e363@mail.gmail.com...
Heres the code.
if ((2.0/3.0) != MyAnn::getCondProb(std::string("+cancer"), std::string("+test"), vps));
     BOOST_ERROR("getCondProb");
  if((1.0/2.0) != MyAnn::getProb(std::string("+cancer"), vps, 1));
     BOOST_ERROR("getProb");
  if((3.0/4.0) != MyAnn::getProb(std::string("+test"), vps, 2));
     BOOST_ERROR("getProb");
  if((1.0/2.0) != MyAnn::getProbAND(std::string("+cancer"), std::string("+test"), vps));
     BOOST_ERROR("getCondProbAND");
  if((3.0/4.0) != MyAnn::getProbOR(std::string("+cancer"), std::string("+test"), vps));
     BOOST_ERROR("getCondProbOR");
  BOOST_CHECK(( 2.0/3.0) == MyAnn::getCondProb(std::string("+cancer"), std::string("+test"), vps));
  BOOST_CHECK((1.0/2.0) == MyAnn::getProb(std::string("+cancer"), vps, 1));
  BOOST_CHECK((3.0/4.0) == MyAnn::getProb(std::string("+test"), vps, 2));
  BOOST_CHECK((1.0/2.0) == MyAnn::getProbAND(std::string("+cancer"), std::string("+test"), vps));
  BOOST_CHECK((3.0/4.0) == MyAnn::getProbOR(std::string("+cancer"), std::string("+test"), vps));


Heres the result:
C:\CPW\cs_classes\cs461\c++\BayesianTest.cpp(144): getCondProb in function: 'int
 test_main(int, char**)'
C:\CPW\cs_classes\cs461\c++\BayesianTest.cpp(146): getProb in function: 'int tes
t_main(int, char**)'
C:\CPW\cs_classes\cs461\c++\BayesianTest.cpp(148): getProb in function: 'int tes
t_main(int, char**)'
C:\CPW\cs_classes\cs461\c++\BayesianTest.cpp(150): getCondProbAND in function: '
int test_main(int, char**)'
C:\CPW\cs_classes\cs461\c++\BayesianTest.cpp(152): getCondProbOR in function: 'i
nt test_main(int, char**)'
C:\CPW\cs_classes\cs461\c++\BayesianTest.cpp(156): test (1.0 /2.0) == MyAnn::getP
robAND(std::string("+cancer"), std::string("+test"), vps) failed in function: 'i
nt test_main(int, char**)'
C:\CPW\cs_classes\cs461\c++\BayesianTest.cpp(157): test ( 3.0/4.0) == MyAnn::getP
robOR(std::string("+cancer"), std::string("+test"), vps) failed in function: 'in
t test_main(int, char**)'
C:/Boost/include/boost_1_34/boost/test/minimal.hpp(122): exception "std::excepti
on: boost::bad_format_string: format-string is ill-formed" caught in function: '
int main(int, char**)'

I like to know what went wrong .. and how come its failing? its using boost 1.34


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users