/** Source code example for "A Practical Introduction to Data Structures and Algorithm Analysis, 3rd Edition (Java)" by Clifford A. Shaffer Copyright 2008-2011 by Clifford A. Shaffer */ /** A JUnit test class for sort algorithms */ import java.io.*; public class SortTest extends junit.framework.TestCase { final static int testsize = 1000; static Integer A[]; static int THRESHOLD = 8; static > void Sort(E[] A) { for (int i=0; ii; j--) if ((A[j].compareTo(A[j-1]) < 0)) DSutil.swap(A, j, j-1); } /** * This method is automatically called once before each test case * method, so that all the variables are cleanly initialized for * each test. */ public void setUp() { A = new Integer[testsize]; for (int i=0; i