/** * Tests an absolute number. */ public void testAbsolute() { performTest(5, 5); }
/** * performs the actual test. * * @param numSel the number of attributes to select * @param numOut the number of attributes that are expected */ protected void performTest(double numSel, int numOut) { m_Filter = getFilter(numSel); Instances icopy = new Instances(m_Instances); Instances result = null; try { m_Filter.setInputFormat(icopy); } catch (Exception ex) { ex.printStackTrace(); fail("Exception thrown on setInputFormat(): \n" + ex.getMessage()); } try { result = Filter.useFilter(icopy, m_Filter); assertNotNull(result); } catch (Exception ex) { ex.printStackTrace(); fail("Exception thrown on useFilter(): \n" + ex.getMessage()); } assertEquals(numOut, result.numAttributes()); assertEquals(icopy.numInstances(), m_Instances.numInstances()); }
/** * Runs the test from commandline. * * @param args ignored */ public static void main(String[] args){ junit.textui.TestRunner.run(suite()); } }
/** * performs the actual test. * * @param numSel the number of attributes to select * @param numOut the number of attributes that are expected */ protected void performTest(double numSel, int numOut) { m_Filter = getFilter(numSel); Instances icopy = new Instances(m_Instances); Instances result = null; try { m_Filter.setInputFormat(icopy); } catch (Exception ex) { ex.printStackTrace(); fail("Exception thrown on setInputFormat(): \n" + ex.getMessage()); } try { result = Filter.useFilter(icopy, m_Filter); assertNotNull(result); } catch (Exception ex) { ex.printStackTrace(); fail("Exception thrown on useFilter(): \n" + ex.getMessage()); } assertEquals(numOut, result.numAttributes()); assertEquals(icopy.numInstances(), m_Instances.numInstances()); }
/** * Runs the test from commandline. * * @param args ignored */ public static void main(String[] args){ junit.textui.TestRunner.run(suite()); } }
/** * Tests a percentage. */ public void testPercentage() { performTest(0.5, 4); }
/** * Tests an absolute number. */ public void testAbsolute() { performTest(5, 5); }
/** * Tests a percentage. */ public void testPercentage() { performTest(0.5, 4); }