package baseCode.math;

import junit.framework.TestCase;

/**
 * <hr>
 * <p>
 * Copyright (c) 2004-2005 Columbia University
 * 
 * @author pavlidis
 * @version $Id$
 */
public class StringDistanceTest extends TestCase {

    /*
     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
    }

    /*
     * @see TestCase#tearDown()
     */
    protected void tearDown() throws Exception {
        super.tearDown();
    }

    /*
     * Test method for 'baseCode.math.StringDistance.hammingDistance(String, String)'
     */
    public void testHammingDistance() {
        assertEquals( 1, StringDistance.hammingDistance( "foobly", "goobly" ) );
        assertEquals( 2, StringDistance.hammingDistance( "fooblybar", "gooblyfar" ) );
    }

    /*
     * Test method for 'baseCode.math.StringDistance.editDistance(String, String)'
     */
    public void testEditDistanceA() {
        assertEquals( 1, StringDistance.editDistance( "foobly", "goobly" ) );
    }

    /*
     * Test method for 'baseCode.math.StringDistance.editDistance(String, String)'
     */
    public void testEditDistanceB() {
        assertEquals( 1, StringDistance.editDistance( "goobly", "foobly" ) );
    }

    /*
     * Test method for 'baseCode.math.StringDistance.editDistance(String, String)'
     */
    public void testEditDistanceC() {
        assertEquals( 2, StringDistance.editDistance( "GUMBO", "GAMBOL" ) );
    }

    /*
     * Test method for 'baseCode.math.StringDistance.editDistance(String, String)'
     */
    public void testEditDistanceD() {
        assertEquals( 1, StringDistance.editDistance( "GAMBOL", "GAMBOLA" ) );
    }

    /*
     * Test method for 'baseCode.math.StringDistance.editDistance(String, String)'
     */
    public void testEditDistanceE() {
        assertEquals( 1, StringDistance.editDistance( "GAMBFOL", "GAMBOL" ) );
    }

    /*
     * Test method for 'baseCode.math.StringDistance.editDistance(String, String)'
     */
    public void testEditDistanceF() {
        assertEquals( 1, StringDistance.editDistance( "GAMBOL", "GAMBFOL" ) );
    }

    /*
     * Test method for 'baseCode.math.StringDistance.editDistance(String, String)'
     */
    public void testEditDistanceG() {
        assertEquals( 5, StringDistance.editDistance( "GAMBOL", "GAMBFOLIAGE" ) );
    }

    /*
     * Test method for 'baseCode.math.StringDistance.editDistance(String, String)'
     */
    public void testEditDistanceH() {
        assertEquals( 6, StringDistance.editDistance( "GAMBOL", "" ) );
    }
}

@@ -2547,10 +2547,500 @@
 ;%0A    %7D%0A
+%0A    public void testBadMatch() %7B%0A        String sa = %22HCC1954Cy3vsHMECCy5r2; src: MDA-MB436 Breast Cancer cell line; src: Human Mammary Epithelial Cells%22;%0A        String sb = %22Normal Breast Epithelium Control replicate 2 133B; src: Human Mammary Epithelial Cells%22;%0A        int distance = StringDistance.editDistance( sa, sb );%0A        double normalizedDistance = ( double ) distance / Math.max( sa.length(), sb.length() );%0A        assertEquals( 0.5208, normalizedDistance, 0.001 );%0A    %7D%0A%0A
 %7D%0A

add test for 'bad match'