Changeset 931 for trunk/test/ncc_test.cc


Ignore:
Timestamp:
Oct 5, 2007, 5:42:25 PM (16 years ago)
Author:
Markus Ringnér
Message:

Working on ticket:259. Removed old Distance see ticket:250

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/ncc_test.cc

    r925 r931  
    2323
    2424#include "yat/classifier/IGP.h"
     25#include "yat/classifier/Kernel_MEV.h"
     26#include "yat/classifier/KernelLookup.h"
    2527#include "yat/classifier/MatrixLookup.h"
    2628#include "yat/classifier/MatrixLookupWeighted.h"
    2729#include "yat/classifier/NCC.h"
     30#include "yat/classifier/PolynomialKernelFunction.h"
    2831#include "yat/classifier/Target.h"
    2932#include "yat/utility/matrix.h"
     
    3437#include <fstream>
    3538#include <iostream>
     39#include <stdexcept>
    3640#include <sstream>
    3741#include <string>
     
    5559  bool ok = true;
    5660
    57   classifier::MatrixLookupWeighted ml(4,4);
     61  classifier::MatrixLookup ml(4,4);
    5862  std::vector<std::string> vec(4, "pos");
    5963  vec[3]="bjds";
     
    131135    ok = false;
    132136  }
     137
     138  // testing rejection of KernelLookups
     139  classifier::PolynomialKernelFunction kf;
     140  classifier::Kernel_MEV kernel(ml,kf);
     141  classifier::DataLookup2D* dl_kernel = new classifier::KernelLookup(kernel);
     142  try {
     143    ok=0; // should catch error here
     144    *error << ncc.make_classifier(*dl_kernel,target) << std::endl;
     145  }
     146  catch (std::runtime_error) {   
     147    *error << "caught expected bad cast runtime_error" << std::endl;
     148    ok=1;
     149  }
     150  delete dl_kernel;
    133151 
    134 
    135152  if(ok)
    136153    *error << "OK" << std::endl;
Note: See TracChangeset for help on using the changeset viewer.