Ignore:
Timestamp:
Dec 22, 2005, 4:03:51 PM (16 years ago)
Author:
Peter
Message:

I dont know what happened, but everything is changed...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/inputranker_test.cc

    r453 r475  
    44#include <c++_tools/statistics/ROC.h>
    55#include <c++_tools/gslapi/matrix.h>
     6#include <c++_tools/gslapi/matrix.h>
     7#include <c++_tools/classifier/MatrixLookup.h>
     8#include <c++_tools/classifier/Target.h>
    69
    710#include <cstdlib>
     
    912#include <iostream>
    1013
    11 using namespace theplu;
    1214
    13 int main()
    14 
     15
     16int main(const int argc,const char* argv[])
     17{
     18  using namespace theplu;
     19  std::ostream* error;
     20  if (argc>1 && argv[1]==std::string("-v"))
     21    error = &std::cerr;
     22  else {
     23    error = new std::ofstream("/dev/null");
     24    if (argc>1)
     25      std::cout << "inputranker_test -v : for printing extra information\n";
     26  }
     27  *error << "testing inputranker" << std::endl;
     28  bool ok = true;
     29
    1530  std::ifstream is("data/rank_data.txt");
    16   gslapi::matrix data(is);
     31  theplu::gslapi::matrix data_tmp(is);
     32  theplu::classifier::MatrixLookup data(data_tmp);
    1733  is.close();
    1834
    1935  is.open("data/rank_target.txt");
    20   theplu::gslapi::vector target(is);
     36  classifier::Target target(is);
    2137  is.close();
    2238
    2339  statistics::ROC roc;
    2440  classifier::InputRanker ir(data,target,roc);
    25 
    2641  if (ir.id(0)!=2 || ir.id(1)!=0 || ir.id(2)!=1){
    27     std::cerr << "wrong id" << std::endl;
    28     return -1;
     42    *error << "wrong id" << std::endl;
     43    ok=false;
    2944  }
    3045 
     46  *error << "second test" << std::endl;
    3147  if (ir.rank(0)!=1 || ir.rank(1)!=2 || ir.rank(2)!=0){
    32     std::cerr << "wrong rank" << std::endl;
    33     return -1;
     48    *error << "wrong rank" << std::endl;
     49    ok=false;
    3450  }
    3551 
    36   return 0;
     52  if (error!=&std::cerr)
     53    delete error;
     54
     55  return (ok ? 0 : -1);
     56
    3757}
Note: See TracChangeset for help on using the changeset viewer.