source: branches/MetisMQI/src/test/java/weka/filters/unsupervised/attribute/NumericCleanerTest.java

Last change on this file was 29, checked in by gnappo, 15 years ago

Taggata versione per la demo e aggiunto branch.

File size: 2.3 KB
Line 
1/*
2 *    This program is free software; you can redistribute it and/or modify
3 *    it under the terms of the GNU General Public License as published by
4 *    the Free Software Foundation; either version 2 of the License, or
5 *    (at your option) any later version.
6 *
7 *    This program is distributed in the hope that it will be useful,
8 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 *    GNU General Public License for more details.
11 *
12 *    You should have received a copy of the GNU General Public License
13 *    along with this program; if not, write to the Free Software
14 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15 */
16
17/*
18 * Copyright (C) 2006 University of Waikato, Hamilton, New Zealand
19 */
20
21package weka.filters.unsupervised.attribute;
22
23import weka.core.Instances;
24import weka.filters.AbstractFilterTest;
25import weka.filters.Filter;
26
27import junit.framework.Test;
28import junit.framework.TestSuite;
29
30/**
31 * Tests NumericCleaner. Run from the command line with: <p/>
32 * java weka.filters.unsupervised.attribute.NumericCleanerTest
33 *
34 * @author FracPete (fracpete at waikato dot ac dot nz)
35 * @version $Revision: 1.1 $
36 */
37public class NumericCleanerTest 
38  extends AbstractFilterTest {
39 
40  public NumericCleanerTest(String name) { 
41    super(name); 
42  }
43
44  /** Creates a default NumericCleaner */
45  public Filter getFilter() {
46    return new NumericCleaner();
47  }
48
49  /**
50   * runs a simple test
51   */
52  public void testTypical() {
53    Instances icopy = new Instances(m_Instances);
54    Instances result = null;
55    try {
56      m_Filter.setInputFormat(icopy);
57    } 
58    catch (Exception ex) {
59      ex.printStackTrace();
60      fail("Exception thrown on setInputFormat(): \n" + ex.getMessage());
61    }
62    try {
63      result = Filter.useFilter(icopy, m_Filter);
64      assertNotNull(result);
65    } 
66    catch (Exception ex) {
67      ex.printStackTrace();
68      fail("Exception thrown on useFilter(): \n" + ex.getMessage());
69    }
70
71    assertEquals(icopy.numAttributes(), result.numAttributes());
72    assertEquals(icopy.numInstances(), result.numInstances());
73  }
74
75  public static Test suite() {
76    return new TestSuite(NumericCleanerTest.class);
77  }
78
79  public static void main(String[] args){
80    junit.textui.TestRunner.run(suite());
81  }
82}
Note: See TracBrowser for help on using the repository browser.