source: branches/MetisMQI/src/test/java/weka/core/converters/MatlabTest.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.6 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) 2009 University of Waikato, Hamilton, New Zealand
19 */
20
21package weka.core.converters;
22
23import weka.core.TestInstances;
24
25import junit.framework.Test;
26import junit.framework.TestSuite;
27
28/**
29 * Tests MatlabLoader/MatlabSaver. Run from the command line with:<p/>
30 * java weka.core.converters.MatlabTest
31 *
32 * @author FracPete (fracpete at waikato dot ac dot nz)
33 * @version $Revision: 5419 $
34 */
35public class MatlabTest 
36  extends AbstractFileConverterTest {
37
38  /**
39   * Constructs the <code>MatlabTest</code>.
40   *
41   * @param name the name of the test class
42   */
43  public MatlabTest(String name) { 
44    super(name); 
45  }
46
47  /**
48   * returns the loader used in the tests.
49   *
50   * @return the configured loader
51   */
52  public AbstractLoader getLoader() {
53    return new MatlabLoader();
54  }
55
56  /**
57   * returns the saver used in the tests.
58   *
59   * @return the configured saver
60   */
61  public AbstractSaver getSaver() {
62    return new MatlabSaver();
63  }
64
65  /**
66   * returns the test data generator.
67   *
68   * @return    the configured test data generator
69   */
70  protected TestInstances getTestInstances() {
71    return TestInstances.forCapabilities(new MatlabSaver().getCapabilities());
72  }
73 
74  /**
75   * Called by JUnit before each test method. This implementation creates
76   * the default loader/saver to test and generates a test set of Instances.
77   *
78   * @throws Exception if an error occurs reading the example instances.
79   */
80  protected void setUp() throws Exception {
81    super.setUp();
82   
83    m_MaxDiffValues  = 1E-6;
84    m_MaxDiffWeights = 0.0;
85    m_CheckHeader    = false;
86  }
87
88  /**
89   * returns a test suite.
90   *
91   * @return the test suite
92   */
93  public static Test suite() {
94    return new TestSuite(MatlabTest.class);
95  }
96
97  /**
98   * for running the test from commandline.
99   *
100   * @param args the commandline arguments - ignored
101   */
102  public static void main(String[] args){
103    junit.textui.TestRunner.run(suite());
104  }
105}
Note: See TracBrowser for help on using the repository browser.