package username.dynamic; import java.io.PrintWriter; /** * Test the edit method (mostly to find out the number of calls. * * @author Samuel A. Rebelsky * @version 1.0 of March 2006 */ public class TestEdit { static final int INSERT = 2; static final int DELETE = 1; public static void main(String[] args) { PrintWriter pen = new PrintWriter(System.out, true); pen.println("Using an insertion cost of " + INSERT + "."); pen.println("Using a deletion cost of " + DELETE + "."); helper(pen, "hello", "hello"); helper(pen, "hello", "'ello"); helper(pen, "abcde", "fghij"); helper(pen, "abcdefg", "zxywvut"); // helper(pen, "abcde", "abcdf"); // helper(pen, "abcdef", "bcdef"); // helper(pen, "pizza", "zapme"); } // main(String[] public static void helper(PrintWriter pen, String source, String target) { pen.println("To convert " + source + " to " + target); StringUtils.reset(); pen.println(" Edit cost: " + StringUtils.ec(source, target, INSERT, DELETE)); pen.println(" Calls: " + StringUtils.getCalls()); } // helper(PrintWriter, String, String) } // class TestEdit