0

単体テスト用に次のコードがあります。

BOOST_AUTO_TEST_CASE (test_adapter) {
  boost::random::mt19937 gen;
  boost::normal_distribution<> nd1(10.0,31.0);
  unsigned int imax = 1000;
  std::vector<double> x, x_p;
  for (unsigned int k = 0 ; k < 1000 ; k++) {
    std::vector<double>().swap(x);
    std::vector<double>().swap(x_p);
    for (unsigned int i = 0 ; i < imax ; i++) {
      x.push_back(nd1(gen));
      x_p.push_back(nd1(gen));
        }
   }
        log_rtns <double >lr;
        BOOST_CHECK(lr( x, x_p) == false );

}

これは私の log_rtns です:

template<class T>
class log_rtns: public std::binary_function<T,T,bool> {
 public:
  inline bool operator()(T t, T t_p) {return (std::log(t/t_p));}
};
4

1 に答える 1