Boost logo

Boost Users :

From: Stephen Torri (torrisa_at_[hidden])
Date: 2008-03-14 10:58:45


Here is my updated test program. The compiler still complains about the
undefined reference to main.

-----------------------
Compile results

/bin/bash ../../../../libtool --tag=CXX --mode=link g++ -g -O2 -Werror -DNO_LIBREVERSE_DEBUG -static -o test_grnn test_grnn-test_grnn.o \
-L../../../../libreverse -lreverse -lboost_date_time -lboost_unit_test_framework
g++ -g -O2 -Werror -DNO_LIBREVERSE_DEBUG -o test_grnn test_grnn-test_grnn.o -L/home/storri/src/libreverse/libreverse /home/storri/src/libre\
verse/libreverse/.libs/libreverse.a -L/Libs -L/lib -licui18n /usr/lib/libexpat.so -lboost_filesystem -lgcov -lboost_date_time -lboost_unit_t\
est_framework
/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make[1]: *** [test_grnn] Error 1
make[1]: Leaving directory `/home/storri/src/libreverse/libreverse/components/input/grnn'
make: *** [check-am] Error 2

-----------------------

#include <boost/format.hpp>

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE GRNN test suite

// Boost Test declaration and Checking macro
#include <boost/test/unit_test_suite.hpp>
#include <boost/test/test_tools.hpp>

#include "Java_Training_Data.h"
#include "GRNN.h"

#include "libreverse/Reverse.h"
#include "libreverse/Trace.h"
#include <iostream>

using namespace libreverse::trace;
using namespace libreverse;

BOOST_AUTO_TEST_SUITE(grnn)

BOOST_AUTO_TEST_CASE(test_distance_squared)
{
  double sigma = 0.002;

  classifier_types::Variable_Map::map_type training_map;
  training_map.insert ( std::make_pair ( 0, 0.0 ) );
  training_map.insert ( std::make_pair ( 1, 0.0 ) );
  training_map.insert ( std::make_pair ( 2, 0.0 ) );
  training_map.insert ( std::make_pair ( 3, 0.0 ) );
  training_map.insert ( std::make_pair ( 4, 0.0 ) );
  training_map.insert ( std::make_pair ( 5, 0.0 ) );

  classifier_types::Training_Set<classifier::Java_Training_Data>::Candidate_Data_Map_t training_set;
  training_set.push_back ( training_map );
  
  classifier_types::Variable_Map::map_type verification_map;
  verification_map.insert ( std::make_pair ( 0, 1.0 ) );
  verification_map.insert ( std::make_pair ( 1, 1.0 ) );
  verification_map.insert ( std::make_pair ( 2, 1.0 ) );
  verification_map.insert ( std::make_pair ( 3, 1.0 ) );
  verification_map.insert ( std::make_pair ( 4, 1.0 ) );
  verification_map.insert ( std::make_pair ( 5, 1.0 ) );

  classifier_types::Training_Set<classifier::Java_Training_Data>::Candidate_Data_Map_t verification_set;
  verification_set.push_back ( verification_map );

  classifier::GRNN<classifier::Java_Training_Data> src_ref ( sigma,
                                                             training_set,
                                                             verification_set );

  double distance_squared = src_ref.distance_squared ( verification_set.begin(), training_set.begin() );
  std::cout << boost::format ( "Distance squared: %1$1.10f" ) % distance_squared << std::endl;

  if ( distance_squared == 5.0 )
    {
      std::cout << "SUCCESS" << std::endl;
    }
  else
    {
      std::cout << "FAILED" << std::endl;
    }
}

BOOST_AUTO_TEST_SUITE_END()


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net