[Nodal-cvs] j-test/src/test/storage/memory TestPaths.java,1.2,1.3 TestmemMapContent.java,1.2,1.3 Tes
Status: Pre-Alpha
Brought to you by:
leei
From: Lee I. <le...@us...> - 2005-01-08 00:54:59
|
Update of /cvsroot/nodal/j-test/src/test/storage/memory In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1818/src/test/storage/memory Modified Files: TestPaths.java TestmemMapContent.java TestmemIntSequenceContent.java TestBareSequence.java TestmemOperator.java TestmemStringContent.java TestmemGenericSequenceContent.java Log Message: Reflect IOException throws from Repository and Document access. Index: TestmemGenericSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/j-test/src/test/storage/memory/TestmemGenericSequenceContent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestmemGenericSequenceContent.java 12 Nov 2004 19:24:50 -0000 1.2 --- TestmemGenericSequenceContent.java 8 Jan 2005 00:54:49 -0000 1.3 *************** *** 3,6 **** --- 3,7 ---- package test.storage.memory; + import java.io.IOException; import java.util.Vector; *************** *** 14,18 **** import org.nodal.model.Setter; import org.nodal.nav.Path; [...1487 lines suppressed...] } }; ! public void testExecuteReplaceRange_case5back() { ! ! Vector originVec = cloneContent(); try { ! executeReplaceRange(-(iseq.size() + 9), -1, new Integer(8)); ! fail("expected ConstraintFailure"); ! } catch (ConstraintFailure e) { //must go here because of out-of-range reference //System.err.println("Caught ConstraintFailure: " + e.getMessage()); ! } finally { //the content should be unchanged ! compareSequences(originVec); } }; ! ! } \ No newline at end of file Index: TestPaths.java =================================================================== RCS file: /cvsroot/nodal/j-test/src/test/storage/memory/TestPaths.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestPaths.java 12 Nov 2004 19:24:50 -0000 1.2 --- TestPaths.java 8 Jan 2005 00:54:49 -0000 1.3 *************** *** 10,13 **** --- 10,15 ---- package test.storage.memory; + import java.io.IOException; + import junit.framework.TestCase; *************** *** 15,19 **** import org.nodal.Types; import org.nodal.model.Node; ! import org.nodal.nav.Path.Failure; import org.nodal.type.SequenceType; import org.nodal.type.Schema; --- 17,21 ---- import org.nodal.Types; import org.nodal.model.Node; ! import org.nodal.nav.Path; import org.nodal.type.SequenceType; import org.nodal.type.Schema; *************** *** 22,26 **** import storage.trans.TransientRepository; ! /** JUnit TestCase. * @testfamily JUnit * @testkind testcase --- 24,30 ---- import storage.trans.TransientRepository; ! /** ! * JUnit TestCase. ! * * @testfamily JUnit * @testkind testcase *************** *** 33,56 **** protected TransientRepository repo; ! public TestPaths(String name) { super(name); } ! /** Sets up the fixture, for example, open a network connection. ! * This method is called before a test is executed. */ protected void setUp() { try { ! repo = (TransientRepository) Nodal.openRepository ("memory://transient"); ! } catch (Failure e) { ! fail(); ! } ! typeDoc = Types.createSchema ("memory://transient/testme.nls").edit (); ! try { ! intSeqType = typeDoc.createSequenceType (Types.SHORT); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail ("Unable to create sequence of shorts: "+e1); } --- 37,63 ---- protected TransientRepository repo; ! public TestPaths(String name) { super(name); } ! /** ! * Sets up the fixture, for example, open a network connection. This method is ! * called before a test is executed. ! */ protected void setUp() { try { ! repo = (TransientRepository) Nodal.openRepository("memory://transient"); ! typeDoc = Types.createSchema("memory://transient/testme.nls").edit(); ! ! intSeqType = typeDoc.createSequenceType(Types.SHORT); ! } catch (Path.Failure e) { ! fail(); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail("Unable to create sequence of shorts: " + e1); ! } catch (IOException e) { ! fail(); } *************** *** 58,71 **** } ! /** Tears down the fixture, for example, close a network connection. ! * This method is called after a test is executed. */ protected void tearDown() { ! repo.close (); } ! public void testBarePaths () { ! Node n = repo.createNode (intSeqType); ! //System.err.println (n.path ()); } ! } --- 65,80 ---- } ! /** ! * Tears down the fixture, for example, close a network connection. This ! * method is called after a test is executed. ! */ protected void tearDown() { ! repo.close(); } ! public void testBarePaths() { ! Node n = repo.createNode(intSeqType); ! //System.err.println (n.path ()); } ! } \ No newline at end of file Index: TestmemStringContent.java =================================================================== RCS file: /cvsroot/nodal/j-test/src/test/storage/memory/TestmemStringContent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestmemStringContent.java 12 Nov 2004 19:24:50 -0000 1.2 --- TestmemStringContent.java 8 Jan 2005 00:54:49 -0000 1.3 *************** *** 3,6 **** --- 3,8 ---- package test.storage.memory; + import java.io.IOException; + import junit.framework.TestCase; *************** *** 12,16 **** import org.nodal.model.SequenceNode; import org.nodal.model.Setter; ! import org.nodal.nav.Path.Failure; import org.nodal.type.SequenceType; import org.nodal.type.Schema; --- 14,18 ---- import org.nodal.model.SequenceNode; import org.nodal.model.Setter; ! import org.nodal.nav.Path; import org.nodal.type.SequenceType; import org.nodal.type.Schema; *************** *** 22,30 **** import storage.trans.TransientRepository; ! /** JUnit TestCase. * @testfamily JUnit * @testkind testcase * @testsetup Default TestCase ! * @testedclass org.nodal.storage.memory.memGenericSequenceContent*/ public class TestmemStringContent extends TestCase { protected Schema.Editor typeDoc; --- 24,35 ---- import storage.trans.TransientRepository; ! /** ! * JUnit TestCase. ! * * @testfamily JUnit * @testkind testcase * @testsetup Default TestCase ! * @testedclass org.nodal.storage.memory.memGenericSequenceContent ! */ public class TestmemStringContent extends TestCase { protected Schema.Editor typeDoc; *************** *** 40,58 **** } ! /** Sets up the fixture, for example, open a network connection. ! * This method is called before a test is executed. */ protected void setUp() { try { repo = (TransientRepository) Nodal.openRepository("memory://transient"); - } catch (Failure e) { - fail(); - } ! typeDoc = Types.createSchema("memory://transient/testme.nls").edit(); ! try { charSeqType = typeDoc.createSequenceType(Types.CHARACTER); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail ("Unable to create sequence of characters: "+e1); } --- 45,66 ---- } ! /** ! * Sets up the fixture, for example, open a network connection. This method is ! * called before a test is executed. ! */ protected void setUp() { try { repo = (TransientRepository) Nodal.openRepository("memory://transient"); ! typeDoc = Types.createSchema("memory://transient/testme.nls").edit(); ! charSeqType = typeDoc.createSequenceType(Types.CHARACTER); + } catch (Path.Failure e) { + fail(); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail("Unable to create sequence of characters: " + e1); ! } catch (IOException e) { ! fail(); } *************** *** 73,78 **** } ! /** Tears down the fixture, for example, close a network connection. ! * This method is called after a test is executed. */ protected void tearDown() { repo.close(); --- 81,88 ---- } ! /** ! * Tears down the fixture, for example, close a network connection. This ! * method is called after a test is executed. ! */ protected void tearDown() { repo.close(); *************** *** 97,101 **** private StringBuffer cloneContent() { try { ! return new StringBuffer (((CharSeq) cseqAll.get()).toString()); } catch (PropertyConstraintFailure f) { fail("cseqAll.get() failed"); --- 107,111 ---- private StringBuffer cloneContent() { try { ! return new StringBuffer(((CharSeq) cseqAll.get()).toString()); } catch (PropertyConstraintFailure f) { fail("cseqAll.get() failed"); *************** *** 159,163 **** fail("Caught ConstraintFailure: " + e.getMessage()); } finally { ! //System.out.println (" cseq.str = \""+cseq.str+"\""); //System.out.println (" origin = \""+originStr+"\""); compareSequences(originStr); --- 169,173 ---- fail("Caught ConstraintFailure: " + e.getMessage()); } finally { ! //System.out.println (" cseq.str = \""+cseq.str+"\""); //System.out.println (" origin = \""+originStr+"\""); compareSequences(originStr); *************** *** 183,187 **** //boolean tmp = true; StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //manually append val into the original content originStr.append(testStr12); --- 193,197 ---- //boolean tmp = true; StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //manually append val into the original content originStr.append(testStr12); *************** *** 207,211 **** StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //manually convert the backward index to forward one --- 217,221 ---- StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //manually convert the backward index to forward one *************** *** 221,230 **** fail("Caught ConstraintFailure: " + e.getMessage()); } finally { ! //System.out.println (" cseq.str = \""+cseq.str+"\""); //System.out.println (" origin = \""+originStr+"\""); compareSequences(originStr); } ! } else ! fail("Sequence is too short for backward reference"); } --- 231,239 ---- fail("Caught ConstraintFailure: " + e.getMessage()); } finally { ! //System.out.println (" cseq.str = \""+cseq.str+"\""); //System.out.println (" origin = \""+originStr+"\""); compareSequences(originStr); } ! } else fail("Sequence is too short for backward reference"); } *************** *** 235,239 **** StringBuffer originStr = cloneContent(); ! //copy the original content for validation later originStr.insert((cseq.size() / 2 + 1), testStr22); //--------case (4)--------------- --- 244,248 ---- StringBuffer originStr = cloneContent(); ! //copy the original content for validation later originStr.insert((cseq.size() / 2 + 1), testStr22); //--------case (4)--------------- *************** *** 254,258 **** StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //--------case (5)--------------- //System.err.println("originStr: " + originStr); --- 263,267 ---- StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //--------case (5)--------------- //System.err.println("originStr: " + originStr); *************** *** 302,306 **** StringBuffer originStr = cloneContent(); ! //copy the original content for validation later originStr.insert(cseq.size() - 1, testStr22); //--------case (2)--------------- --- 311,315 ---- StringBuffer originStr = cloneContent(); ! //copy the original content for validation later originStr.insert(cseq.size() - 1, testStr22); //--------case (2)--------------- *************** *** 321,325 **** StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //manually convert the backward index to forward one //System.err.println("originStr: " + originStr); --- 330,334 ---- StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //manually convert the backward index to forward one //System.err.println("originStr: " + originStr); *************** *** 337,351 **** compareSequences(originStr); } ! } else ! fail("Sequence is too short for backward reference"); }; public void testInsertBefore_case4() { ! //System.err.println("***test case 4 for executeInsertBefore (int, object)"); String testStr24 = "yzq"; StringBuffer originStr = cloneContent(); ! //copy the original content for validation later originStr.insert((cseq.size() / 2), testStr24); //System.err.println("originStr: " + originStr); --- 346,360 ---- compareSequences(originStr); } ! } else fail("Sequence is too short for backward reference"); }; public void testInsertBefore_case4() { ! //System.err.println("***test case 4 for executeInsertBefore (int, ! // object)"); String testStr24 = "yzq"; StringBuffer originStr = cloneContent(); ! //copy the original content for validation later originStr.insert((cseq.size() / 2), testStr24); //System.err.println("originStr: " + originStr); *************** *** 366,370 **** StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //System.err.println("originStr: " + originStr); //--------case (5)--------------- --- 375,379 ---- StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //System.err.println("originStr: " + originStr); //--------case (5)--------------- *************** *** 389,393 **** StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //System.err.println("###originStr: " + originStr); int originStrSize = originStr.length(); --- 398,402 ---- StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //System.err.println("###originStr: " + originStr); int originStrSize = originStr.length(); *************** *** 398,412 **** try { //System.err.println("cseq.size() "+cseq.size()); ! //Remove all the elements in the midde, i.e. exclude the first and last element executeRemoveRange(1, cseq.size() - 2); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); } finally { ! //System.out.println(" cseq.str: \""+cseq.str+"\""); //System.out.println("originStr: \""+originStr+"\""); compareSequences(originStr); } ! } else ! fail("Sequence is too short to remove a subset of it"); }; --- 407,421 ---- try { //System.err.println("cseq.size() "+cseq.size()); ! //Remove all the elements in the midde, i.e. exclude the first and last ! // element executeRemoveRange(1, cseq.size() - 2); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); } finally { ! //System.out.println(" cseq.str: \""+cseq.str+"\""); //System.out.println("originStr: \""+originStr+"\""); compareSequences(originStr); } ! } else fail("Sequence is too short to remove a subset of it"); }; *************** *** 450,454 **** StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //System.err.println("originStr: " + originStr); //--------case (4)--------------- --- 459,463 ---- StringBuffer originStr = cloneContent(); ! //copy the original content for validation later //System.err.println("originStr: " + originStr); //--------case (4)--------------- *************** *** 473,477 **** public void testReplaceRange_case1() { ! //copy the original content for validation later StringBuffer originStr = cloneContent(); //explicitly set the first element to be a 'd' --- 482,486 ---- public void testReplaceRange_case1() { ! //copy the original content for validation later StringBuffer originStr = cloneContent(); //explicitly set the first element to be a 'd' *************** *** 494,498 **** public void testReplaceRange_case2() { ! //--------case (2)--------------- // Create a vector for insert // the vector contains 3 elements --- 503,507 ---- public void testReplaceRange_case2() { ! //--------case (2)--------------- // Create a vector for insert // the vector contains 3 elements *************** *** 513,517 **** public void testReplaceRange_case3() { ! //build the result vector explicitly for testing StringBuffer originStr = cloneContent(); int originStrSize = originStr.length(); --- 522,526 ---- public void testReplaceRange_case3() { ! //build the result vector explicitly for testing StringBuffer originStr = cloneContent(); int originStrSize = originStr.length(); *************** *** 519,525 **** originStr.insert(1, 'e'); //System.err.println("originStr: " + originStr); ! //--------case (3)--------------- if (cseq.size() > 3) { ! // System.err.println("test case 3 for executeReplaceRange(int, int, Object)"); try { --- 528,535 ---- originStr.insert(1, 'e'); //System.err.println("originStr: " + originStr); ! //--------case (3)--------------- if (cseq.size() > 3) { ! // System.err.println("test case 3 for executeReplaceRange(int, int, ! // Object)"); try { *************** *** 530,535 **** compareSequences(originStr); } ! } else ! fail("Sequence is too short to replace a subset of it"); }; --- 540,544 ---- compareSequences(originStr); } ! } else fail("Sequence is too short to replace a subset of it"); }; *************** *** 537,543 **** public void testReplaceRange_case4() { ! //--------case (4)--------------- if (cseq.size() > 3) { ! //System.err.println("test case 4 for executeReplaceRange(int, int, Object)"); //System.err.println("cseq.str: "+cseq.str); // Create a vector for insert --- 546,553 ---- public void testReplaceRange_case4() { ! //--------case (4)--------------- if (cseq.size() > 3) { ! //System.err.println("test case 4 for executeReplaceRange(int, int, ! // Object)"); //System.err.println("cseq.str: "+cseq.str); // Create a vector for insert *************** *** 545,549 **** String testStr = "lkjh"; //System.err.println("Build Successful"); ! //build the result vector explicitly for testing StringBuffer originStr = cloneContent(); int originStrSize = originStr.length(); --- 555,559 ---- String testStr = "lkjh"; //System.err.println("Build Successful"); ! //build the result vector explicitly for testing StringBuffer originStr = cloneContent(); int originStrSize = originStr.length(); *************** *** 561,566 **** compareSequences(originStr); } ! } else ! fail("Sequence is too short to replace a subset of it"); }; --- 571,575 ---- compareSequences(originStr); } ! } else fail("Sequence is too short to replace a subset of it"); }; *************** *** 570,574 **** //--------case (5)--------------- ! //System.err.println("test case 5 for executeReplaceRange(int, int, Object)"); try { executeReplaceRange(0, cseq.size() + 6, new Integer(8)); --- 579,584 ---- //--------case (5)--------------- ! //System.err.println("test case 5 for executeReplaceRange(int, int, ! // Object)"); try { executeReplaceRange(0, cseq.size() + 6, new Integer(8)); *************** *** 590,594 **** StringBuffer originStr = cloneContent(); ! //copy the original content for validation later originStr.setCharAt(originStr.length() - 1, 'h'); //System.err.println("originStr: " + originStr); --- 600,604 ---- StringBuffer originStr = cloneContent(); ! //copy the original content for validation later originStr.setCharAt(originStr.length() - 1, 'h'); //System.err.println("originStr: " + originStr); *************** *** 623,627 **** fail("Caught ConstraintFailure: " + e.getMessage()); } finally { ! //System.out.println (" cseq.str = \""+cseq.str+"\""); //System.out.println (" origin = \""+originStr+"\""); compareSequences(originStr); --- 633,637 ---- fail("Caught ConstraintFailure: " + e.getMessage()); } finally { ! //System.out.println (" cseq.str = \""+cseq.str+"\""); //System.out.println (" origin = \""+originStr+"\""); compareSequences(originStr); *************** *** 632,644 **** StringBuffer originStr = cloneContent(); ! //System.err.println("originStr: " + originStr); removeRange(originStr, 0, cseq.size() - 3); originStr.insert(0, 'e'); ! //System.err.println("originStr: " + originStr); ! //--------case (3)--------------- if (cseq.size() > 3) { ! //System.err.println("test case 3 (backward reference) for executeReplaceRange(int, int, Object)"); try { ! executeReplaceRange(- (cseq.size()), -3, new Character('e')); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); --- 642,655 ---- StringBuffer originStr = cloneContent(); ! //System.err.println("originStr: " + originStr); removeRange(originStr, 0, cseq.size() - 3); originStr.insert(0, 'e'); ! //System.err.println("originStr: " + originStr); ! //--------case (3)--------------- if (cseq.size() > 3) { ! //System.err.println("test case 3 (backward reference) for ! // executeReplaceRange(int, int, Object)"); try { ! executeReplaceRange(-(cseq.size()), -3, new Character('e')); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); *************** *** 646,663 **** compareSequences(originStr); } ! } else ! fail("Sequence is too short to replace a subset of it"); }; ////////////////////////// public void testReplaceRange_case4back() { ! //--------case (4)--------------- if (cseq.size() > 3) { ! //System.err.println("test case 4 (backward reference) for executeReplaceRange(int, int, Object)"); // Create a vector for insert // the vector contains 3 elements String testStr = "zxcv"; ! //build the result vector explicitly for testing StringBuffer originStr = cloneContent(); removeRange(originStr, 0, cseq.size() - 3); --- 657,675 ---- compareSequences(originStr); } ! } else fail("Sequence is too short to replace a subset of it"); }; + ////////////////////////// public void testReplaceRange_case4back() { ! //--------case (4)--------------- if (cseq.size() > 3) { ! //System.err.println("test case 4 (backward reference) for ! // executeReplaceRange(int, int, Object)"); // Create a vector for insert // the vector contains 3 elements String testStr = "zxcv"; ! //build the result vector explicitly for testing StringBuffer originStr = cloneContent(); removeRange(originStr, 0, cseq.size() - 3); *************** *** 665,669 **** try { ! executeReplaceRange(- (cseq.size()), -3, testStr); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); --- 677,681 ---- try { ! executeReplaceRange(-(cseq.size()), -3, testStr); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); *************** *** 671,676 **** compareSequences(originStr); } ! } else ! fail("Sequence is too short to replace a subset of it"); }; --- 683,687 ---- compareSequences(originStr); } ! } else fail("Sequence is too short to replace a subset of it"); }; *************** *** 679,689 **** StringBuffer originStr = cloneContent(); //--------case (5)--------------- ! //System.err.println("test case 5 (backward reference) for executeReplaceRange(int, int, Object)"); try { ! executeReplaceRange(- (cseq.size() + 9), -1, new Integer(8)); fail("expected ConstraintFailure"); } catch (IndexBoundsException e) { //must go here since out-of-range exception ! //System.err.println("Caught ConstraintFailure: " + e.getMessage()); } catch (ConstraintFailure e) { fail("unexpected ConstraintFailure"); --- 690,701 ---- StringBuffer originStr = cloneContent(); //--------case (5)--------------- ! //System.err.println("test case 5 (backward reference) for ! // executeReplaceRange(int, int, Object)"); try { ! executeReplaceRange(-(cseq.size() + 9), -1, new Integer(8)); fail("expected ConstraintFailure"); } catch (IndexBoundsException e) { //must go here since out-of-range exception ! //System.err.println("Caught ConstraintFailure: " + e.getMessage()); } catch (ConstraintFailure e) { fail("unexpected ConstraintFailure"); *************** *** 693,695 **** } }; ! } --- 705,707 ---- } }; ! } \ No newline at end of file Index: TestmemIntSequenceContent.java =================================================================== RCS file: /cvsroot/nodal/j-test/src/test/storage/memory/TestmemIntSequenceContent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestmemIntSequenceContent.java 12 Nov 2004 19:24:50 -0000 1.2 --- TestmemIntSequenceContent.java 8 Jan 2005 00:54:49 -0000 1.3 *************** *** 3,6 **** --- 3,8 ---- package test.storage.memory; + import java.io.IOException; + import junit.framework.TestCase; *************** *** 12,16 **** import org.nodal.model.Setter; import org.nodal.nav.Path; - import org.nodal.nav.Path.Failure; import org.nodal.type.SequenceType; import org.nodal.type.Schema; --- 14,17 ---- *************** *** 22,30 **** import storage.trans.TransientRepository; ! /** JUnit TestCase. * @testfamily JUnit * @testkind testcase * @testsetup Default TestCase ! * @testedclass org.nodal.storage.memory.memIntSequenceContent*/ public final class TestmemIntSequenceContent extends TestCase { protected Schema.Editor typeDoc; --- 23,34 ---- import storage.trans.TransientRepository; ! /** ! * JUnit TestCase. ! * * @testfamily JUnit * @testkind testcase * @testsetup Default TestCase ! * @testedclass org.nodal.storage.memory.memIntSequenceContent ! */ public final class TestmemIntSequenceContent extends TestCase { protected Schema.Editor typeDoc; *************** *** 40,58 **** } ! /** Sets up the fixture, for example, open a network connection. ! * This method is called before a test is executed. */ protected void setUp() { try { repo = (TransientRepository) Nodal.openRepository("memory://transient"); - } catch (Failure e) { - fail(); - } ! typeDoc = Types.createSchema("memory://transient/testme.nds").edit(); ! try { intSeqType = typeDoc.createSequenceType(Types.INTEGER); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail ("Unable to create sequence of integers: "+e1); } --- 44,65 ---- } ! /** ! * Sets up the fixture, for example, open a network connection. This method is ! * called before a test is executed. ! */ protected void setUp() { try { repo = (TransientRepository) Nodal.openRepository("memory://transient"); ! typeDoc = Types.createSchema("memory://transient/testme.nds").edit(); ! intSeqType = typeDoc.createSequenceType(Types.INTEGER); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail("Unable to create sequence of integers: " + e1); ! } catch (Path.Failure e) { ! fail(); ! } catch (IOException e) { ! fail(); } *************** *** 63,67 **** //insert the initial content into the empty "iseq" object ! int testVec[] = { 1, 3, 5, 7, 9, 11 }; try { --- 70,74 ---- //insert the initial content into the empty "iseq" object ! int testVec[] = {1, 3, 5, 7, 9, 11}; try { *************** *** 74,79 **** } ! /** Tears down the fixture, for example, close a network connection. ! * This method is called after a test is executed. */ protected void tearDown() { repo.close(); --- 81,88 ---- } ! /** ! * Tears down the fixture, for example, close a network connection. This ! * method is called after a test is executed. ! */ protected void tearDown() { repo.close(); *************** *** 96,116 **** } ! public void testRange () { // The full range Getter range1 = iseq.range(0, -1); Path path1 = range1.path(); ! System.out.println (range1+".path() = "+path1); ! // Partial range Getter range2 = iseq.range(0, 3); Path path2 = range2.path(); ! System.out.println (range2+".path() = "+path2); ! Getter range3 = iseq.range(0, -1); Path path3 = range3.path(); ! System.out.println (range2+".path() = "+path3); ! assertTrue (path1 == path3); } ! private void checkIndex(int i) throws IndexBoundsException { iseq.item(i); --- 105,125 ---- } ! public void testRange() { // The full range Getter range1 = iseq.range(0, -1); Path path1 = range1.path(); ! System.out.println(range1 + ".path() = " + path1); ! // Partial range Getter range2 = iseq.range(0, 3); Path path2 = range2.path(); ! System.out.println(range2 + ".path() = " + path2); ! Getter range3 = iseq.range(0, -1); Path path3 = range3.path(); ! System.out.println(range2 + ".path() = " + path3); ! assertTrue(path1 == path3); } ! private void checkIndex(int i) throws IndexBoundsException { iseq.item(i); *************** *** 121,126 **** s.append("["); for (int i = 0; i < v.length; ++i) { ! if (i > 0) ! s.append(" "); s.append(v[i]); } --- 130,134 ---- s.append("["); for (int i = 0; i < v.length; ++i) { ! if (i > 0) s.append(" "); s.append(v[i]); } *************** *** 158,165 **** public void testInsertAfter_case1() { ! int testVec11[] = { 2, 4, 6 }; //--------case (1)--------------- ! int[] originVec = { 1, 2, 4, 6, 3, 5, 7, 9, 11 }; //System.err.println("originVec: " + originVec); --- 166,173 ---- public void testInsertAfter_case1() { ! int testVec11[] = {2, 4, 6}; //--------case (1)--------------- ! int[] originVec = {1, 2, 4, 6, 3, 5, 7, 9, 11}; //System.err.println("originVec: " + originVec); *************** *** 187,192 **** public void testInsertAfter_case2() { ! int testVec12[] = { 8, 10, 12 }; ! int originArr[] = { 1, 3, 5, 7, 9, 11, 8, 10, 12 }; //System.err.println("test case 2 for executeInsertAfter(int, Object)"); --- 195,200 ---- public void testInsertAfter_case2() { ! int testVec12[] = {8, 10, 12}; ! int originArr[] = {1, 3, 5, 7, 9, 11, 8, 10, 12}; //System.err.println("test case 2 for executeInsertAfter(int, Object)"); *************** *** 203,209 **** public void testInsertAfter_case3() { ! int testVec13[] = { 14, 16, 18 }; ! int originArr[] = { 1, 3, 5, 7, 9, 14, 16, 18, 11 }; ! //--------case (3)--------------- try { executeInsertAfter(-2, testVec13); --- 211,217 ---- public void testInsertAfter_case3() { ! int testVec13[] = {14, 16, 18}; ! int originArr[] = {1, 3, 5, 7, 9, 14, 16, 18, 11}; ! //--------case (3)--------------- try { executeInsertAfter(-2, testVec13); *************** *** 217,222 **** public void testInsertAfter_case4() { ! int testVec22[] = { 20, 22, 24 }; ! int originArr[] = { 1, 3, 5, 7, 20, 22, 24, 9, 11 }; try { --- 225,230 ---- public void testInsertAfter_case4() { ! int testVec22[] = {20, 22, 24}; ! int originArr[] = {1, 3, 5, 7, 20, 22, 24, 9, 11}; try { *************** *** 231,236 **** public void testInsertAfter_case5() { ! int testVec15[] = { 26, 28, 30 }; ! int originArr[] = { 1, 3, 5, 7, 9, 11 }; try { executeInsertAfter(iseq.size() + 6, testVec15); --- 239,244 ---- public void testInsertAfter_case5() { ! int testVec15[] = {26, 28, 30}; ! int originArr[] = {1, 3, 5, 7, 9, 11}; try { executeInsertAfter(iseq.size() + 6, testVec15); *************** *** 252,257 **** public void testInsertBefore_case1() { ! int testVec21[] = { 32, 34, 36 }; ! int originArr[] = { 32, 34, 36, 1, 3, 5, 7, 9, 11 }; try { --- 260,265 ---- public void testInsertBefore_case1() { ! int testVec21[] = {32, 34, 36}; ! int originArr[] = {32, 34, 36, 1, 3, 5, 7, 9, 11}; try { *************** *** 266,271 **** public void testInsertBefore_case2() { ! int testVec22[] = { 38, 40, 42 }; ! int originArr[] = { 1, 3, 5, 7, 9, 38, 40, 42, 11 }; try { --- 274,279 ---- public void testInsertBefore_case2() { ! int testVec22[] = {38, 40, 42}; ! int originArr[] = {1, 3, 5, 7, 9, 38, 40, 42, 11}; try { *************** *** 280,285 **** public void testInsertBefore_case3() { ! int testVec23[] = { 44, 46, 48 }; ! int originArr[] = { 1, 3, 5, 7, 44, 46, 48, 9, 11 }; try { --- 288,293 ---- public void testInsertBefore_case3() { ! int testVec23[] = {44, 46, 48}; ! int originArr[] = {1, 3, 5, 7, 44, 46, 48, 9, 11}; try { *************** *** 294,299 **** public void testInsertBefore_case4() { ! int testVec24[] = { 50, 52, 54 }; ! int originArr[] = { 1, 3, 5, 50, 52, 54, 7, 9, 11 }; try { executeInsertBefore(iseq.size() / 2, testVec24); --- 302,307 ---- public void testInsertBefore_case4() { ! int testVec24[] = {50, 52, 54}; ! int originArr[] = {1, 3, 5, 50, 52, 54, 7, 9, 11}; try { executeInsertBefore(iseq.size() / 2, testVec24); *************** *** 307,312 **** public void testInsertBefore_case5() { ! int testVec25[] = { 56, 58, 60 }; ! int originArr[] = { 1, 3, 5, 7, 9, 11 }; try { executeInsertBefore(iseq.size() + 6, testVec25); --- 315,320 ---- public void testInsertBefore_case5() { ! int testVec25[] = {56, 58, 60}; ! int originArr[] = {1, 3, 5, 7, 9, 11}; try { executeInsertBefore(iseq.size() + 6, testVec25); *************** *** 324,328 **** //============================================================================== public void testRemoveRange_case1() { ! int originArr[] = { 1, 11 }; try { --- 332,336 ---- //============================================================================== public void testRemoveRange_case1() { ! int originArr[] = {1, 11}; try { *************** *** 351,355 **** public void testRemoveRange_case3() { ! int originArr[] = { 1, 3, 5, 9, 11 }; try { executeRemoveRange(iseq.size() / 2, iseq.size() / 2); --- 359,363 ---- public void testRemoveRange_case3() { ! int originArr[] = {1, 3, 5, 9, 11}; try { executeRemoveRange(iseq.size() / 2, iseq.size() / 2); *************** *** 363,367 **** public void testRemoveRange_case5() { ! int originArr[] = { 3, 5, 7, 9, 11 }; try { executeRemoveRange(0, 0); --- 371,375 ---- public void testRemoveRange_case5() { ! int originArr[] = {3, 5, 7, 9, 11}; try { executeRemoveRange(0, 0); *************** *** 375,379 **** public void testRemoveRange_case4() { ! int originArr[] = { 1, 3, 5, 7, 9, 11 }; try { executeRemoveRange(0, iseq.size() + 5); --- 383,387 ---- public void testRemoveRange_case4() { ! int originArr[] = {1, 3, 5, 7, 9, 11}; try { executeRemoveRange(0, iseq.size() + 5); *************** *** 393,398 **** public void testReplaceRange_case1() { ! int originArr[] = { 8, 3, 5, 7, 9, 11 }; ! //System.err.println (" now: arr = " + iseq.size()); try { --- 401,406 ---- public void testReplaceRange_case1() { ! int originArr[] = {8, 3, 5, 7, 9, 11}; ! //System.err.println (" now: arr = " + iseq.size()); try { *************** *** 408,413 **** public void testReplaceRange_case2() { //System.err.println("~~~~~~~~~~~~~~~~~testcase 2 for replace range"); ! int testVec[] = { 42, 44, 46 }; ! int originArr[] = { 42, 44, 46, 3, 5, 7, 9, 11 }; try { --- 416,421 ---- public void testReplaceRange_case2() { //System.err.println("~~~~~~~~~~~~~~~~~testcase 2 for replace range"); ! int testVec[] = {42, 44, 46}; ! int originArr[] = {42, 44, 46, 3, 5, 7, 9, 11}; try { *************** *** 421,428 **** public void testReplaceRange_case3() { ! //System.err.println("~~~~~~~~~~~~~~~~~testcase 3 for replace range"); ! int originArr[] = { 1, 5 }; if (iseq.size() > 3) { ! //System.err.println("test case 3 for executeReplaceRange(int, int, Object)"); try { --- 429,437 ---- public void testReplaceRange_case3() { ! //System.err.println("~~~~~~~~~~~~~~~~~testcase 3 for replace range"); ! int originArr[] = {1, 5}; if (iseq.size() > 3) { ! //System.err.println("test case 3 for executeReplaceRange(int, int, ! // Object)"); try { *************** *** 433,438 **** compareSequences(originArr); } ! } else ! fail("Sequence is too short to replace a subset of it"); }; --- 442,446 ---- compareSequences(originArr); } ! } else fail("Sequence is too short to replace a subset of it"); }; *************** *** 440,445 **** public void testReplaceRange_case4() { //System.err.println("~~~~~~~~~~~~~~~~~testcase 4 for replace range"); ! int testVec[] = { 48, 50, 52 }; ! int originArr[] = { 1, 48, 50, 52 }; try { executeReplaceRange(1, iseq.size() - 1, testVec); --- 448,453 ---- public void testReplaceRange_case4() { //System.err.println("~~~~~~~~~~~~~~~~~testcase 4 for replace range"); ! int testVec[] = {48, 50, 52}; ! int originArr[] = {1, 48, 50, 52}; try { executeReplaceRange(1, iseq.size() - 1, testVec); *************** *** 454,461 **** //System.err.println("~~~~~~~Test case 5 for replace range"); ! int originArr[] = { 1, 3, 5, 7, 9, 11 }; //--------case (5)--------------- ! //System.err.println("test case 5 for executeReplaceRange(int, int, Object)"); try { executeReplaceRange(0, iseq.size() + 6, new Integer(8)); --- 462,470 ---- //System.err.println("~~~~~~~Test case 5 for replace range"); ! int originArr[] = {1, 3, 5, 7, 9, 11}; //--------case (5)--------------- ! //System.err.println("test case 5 for executeReplaceRange(int, int, ! // Object)"); try { executeReplaceRange(0, iseq.size() + 6, new Integer(8)); *************** *** 474,478 **** public void testReplaceRange_case1back() { ! int originArr[] = { 1, 3, 5, 7, 9, 8 }; try { executeReplaceRange(-1, -1, new Integer(8)); --- 483,487 ---- public void testReplaceRange_case1back() { ! int originArr[] = {1, 3, 5, 7, 9, 8}; try { executeReplaceRange(-1, -1, new Integer(8)); *************** *** 486,491 **** public void testReplaceRange_case2back() { ! int testVec[] = { 10, 12, 14, 16 }; ! int originArr[] = { 1, 3, 5, 7, 10, 12, 14, 16, 11 }; try { executeReplaceRange(-2, -2, testVec); --- 495,500 ---- public void testReplaceRange_case2back() { ! int testVec[] = {10, 12, 14, 16}; ! int originArr[] = {1, 3, 5, 7, 10, 12, 14, 16, 11}; try { executeReplaceRange(-2, -2, testVec); *************** *** 498,507 **** public void testReplaceRange_case3back() { ! int originArr[] = { 5, 9, 11 }; if (iseq.size() > 3) { ! //System.err.println("test case 3 (backward reference) for executeReplaceRange(int, int, Object)"); try { ! executeReplaceRange(- (iseq.size()), -3, new Integer(5)); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); --- 507,517 ---- public void testReplaceRange_case3back() { ! int originArr[] = {5, 9, 11}; if (iseq.size() > 3) { ! //System.err.println("test case 3 (backward reference) for ! // executeReplaceRange(int, int, Object)"); try { ! executeReplaceRange(-(iseq.size()), -3, new Integer(5)); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); *************** *** 509,523 **** compareSequences(originArr); } ! } else ! fail("Sequence is too short to replace a subset of it"); }; public void testReplaceRange_case4back() { ! int testVec[] = { 22, 24, 26, 28 }; ! int originArr[] = { 22, 24, 26, 28, 9, 11 }; if (iseq.size() > 3) { try { ! executeReplaceRange(- (iseq.size()), -3, testVec); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); --- 519,532 ---- compareSequences(originArr); } ! } else fail("Sequence is too short to replace a subset of it"); }; public void testReplaceRange_case4back() { ! int testVec[] = {22, 24, 26, 28}; ! int originArr[] = {22, 24, 26, 28, 9, 11}; if (iseq.size() > 3) { try { ! executeReplaceRange(-(iseq.size()), -3, testVec); } catch (ConstraintFailure e) { fail("Caught ConstraintFailure: " + e.getMessage()); *************** *** 525,536 **** compareSequences(originArr); } ! } else ! fail("Sequence is too short to replace a subset of it"); }; public void testReplaceRange_case5back() { ! int originArr[] = { 1, 3, 5, 7, 9, 11 }; try { ! executeReplaceRange(- (iseq.size() + 9), -1, new Integer(8)); fail("expected ConstraintFailure"); } catch (IndexBoundsException e) { --- 534,544 ---- compareSequences(originArr); } ! } else fail("Sequence is too short to replace a subset of it"); }; public void testReplaceRange_case5back() { ! int originArr[] = {1, 3, 5, 7, 9, 11}; try { ! executeReplaceRange(-(iseq.size() + 9), -1, new Integer(8)); fail("expected ConstraintFailure"); } catch (IndexBoundsException e) { *************** *** 545,547 **** }; ! } --- 553,555 ---- }; ! } \ No newline at end of file Index: TestBareSequence.java =================================================================== RCS file: /cvsroot/nodal/j-test/src/test/storage/memory/TestBareSequence.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestBareSequence.java 12 Nov 2004 19:24:50 -0000 1.2 --- TestBareSequence.java 8 Jan 2005 00:54:49 -0000 1.3 *************** *** 10,13 **** --- 10,14 ---- package test.storage.memory; + import java.io.IOException; import java.util.Vector; *************** *** 21,25 **** import org.nodal.model.Setter; import org.nodal.model.ShortSeq; ! import org.nodal.nav.Path.Failure; import org.nodal.type.SequenceType; import org.nodal.type.Schema; --- 22,26 ---- import org.nodal.model.Setter; import org.nodal.model.ShortSeq; ! import org.nodal.nav.Path; import org.nodal.type.SequenceType; import org.nodal.type.Schema; *************** *** 32,40 **** import storage.trans.TransientRepository; ! /** JUnit TestCase. * @testfamily JUnit * @testkind testcase * @testsetup Default TestCase ! * @testedclass org.nodal.storage.memory.memGenericSequenceContent*/ public final class TestBareSequence extends TestCase { protected Schema.Editor typeDoc; --- 33,44 ---- import storage.trans.TransientRepository; ! /** ! * JUnit TestCase. ! * * @testfamily JUnit * @testkind testcase * @testsetup Default TestCase ! * @testedclass org.nodal.storage.memory.memGenericSequenceContent ! */ public final class TestBareSequence extends TestCase { protected Schema.Editor typeDoc; *************** *** 51,69 **** } ! /** Sets up the fixture, for example, open a network connection. ! * This method is called before a test is executed. */ protected void setUp() { try { repo = (TransientRepository) Nodal.openRepository("memory://transient"); - } catch (Failure e) { - fail(); - } ! typeDoc = Types.createSchema("memory://transient/testme.nls").edit(); ! try { shortSeqType = typeDoc.createSequenceType(Types.SHORT); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail ("Unable to create sequence of strings: "+e1); } --- 55,76 ---- } ! /** ! * Sets up the fixture, for example, open a network connection. This method is ! * called before a test is executed. ! */ protected void setUp() { try { repo = (TransientRepository) Nodal.openRepository("memory://transient"); ! typeDoc = Types.createSchema("memory://transient/testme.nls").edit(); ! shortSeqType = typeDoc.createSequenceType(Types.SHORT); + } catch (Path.Failure e) { + fail(); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail("Unable to create sequence of strings: " + e1); ! } catch (IOException e) { ! fail(); } *************** *** 74,78 **** //insert the initial content into the empty "sseq" object ! short[] testVec = { 1, 3, 5, 7, 9, 11 }; try { --- 81,85 ---- //insert the initial content into the empty "sseq" object ! short[] testVec = {1, 3, 5, 7, 9, 11}; try { *************** *** 84,89 **** } ! /** Tears down the fixture, for example, close a network connection. ! * This method is called after a test is executed. */ protected void tearDown() { repo.close(); --- 91,98 ---- } ! /** ! * Tears down the fixture, for example, close a network connection. This ! * method is called after a test is executed. ! */ protected void tearDown() { repo.close(); *************** *** 162,166 **** testVec11.add(2, new Short((short) 6)); ! short[] originVec = { 1, 2, 4, 6, 3, 5, 7, 9, 11 }; //--------case (1)--------------- --- 171,175 ---- testVec11.add(2, new Short((short) 6)); ! short[] originVec = {1, 2, 4, 6, 3, 5, 7, 9, 11}; //--------case (1)--------------- *************** *** 195,199 **** testVec12.add(2, new Short((short) 12)); ! short originVec[] = { 1, 3, 5, 7, 9, 11, 8, 10, 12 }; //--------case (2)--------------- --- 204,208 ---- testVec12.add(2, new Short((short) 12)); ! short originVec[] = {1, 3, 5, 7, 9, 11, 8, 10, 12}; //--------case (2)--------------- *************** *** 217,221 **** testVec13.add(2, new Short((short) 18)); ! short originVec[] = { 1, 3, 5, 7, 9, 14, 16, 18, 11 }; //--------case (3)--------------- --- 226,230 ---- testVec13.add(2, new Short((short) 18)); ! short originVec[] = {1, 3, 5, 7, 9, 14, 16, 18, 11}; //--------case (3)--------------- *************** *** 228,233 **** compareSequences(originVec); } ! } else ! fail("Sequence is too short for backward reference"); } --- 237,241 ---- compareSequences(originVec); } ! } else fail("Sequence is too short for backward reference"); } *************** *** 239,243 **** testVec22.add(2, new Short((short) 24)); ! short originArr[] = { 1, 3, 5, 7, 20, 22, 24, 9, 11 }; //--------case (4)--------------- --- 247,251 ---- testVec22.add(2, new Short((short) 24)); ! short originArr[] = {1, 3, 5, 7, 20, 22, 24, 9, 11}; //--------case (4)--------------- *************** *** 261,265 **** short[] originVec = cloneContent(); ! //copy the original content for validation later //--------case (5)--------------- //System.err.println("originVec: " + originVec); --- 269,273 ---- short[] originVec = cloneContent(); ! //copy the original content for validation later //--------case (5)--------------- //System.err.println("originVec: " + originVec); *************** *** 287,291 **** testVec21.add(2, new Short((short) 36)); ! short originVec[] = { 32, 34, 36, 1, 3, 5, 7, 9, 11 }; //--------case (1)--------------- --- 295,299 ---- testVec21.add(2, new Short((short) 36)); ! short originVec[] = {32, 34, 36, 1, 3, 5, 7, 9, 11}; //--------case (1)--------------- *************** *** 308,312 **** testVec22.add(2, new Short((short) 42)); ! short originVec[] = { 1, 3, 5, 7, 9, 38, 40, 42, 11 }; //--------case (2)--------------- --- 316,320 ---- testVec22.add(2, new Short((short) 42)); ! short originVec[] = {1, 3, 5, 7, 9, 38, 40, 42, 11}; //--------case (2)--------------- *************** *** 329,333 **** testVec23.add(2, new Short((short) 18)); ! short originVec[] = { 1, 3, 5, 7, 14, 16, 18, 9, 11 }; //--------case (3)--------------- --- 337,341 ---- testVec23.add(2, new Short((short) 18)); ! short originVec[] = {1, 3, 5, 7, 14, 16, 18, 9, 11}; //--------case (3)--------------- *************** *** 342,347 **** compareSequences(originVec); } ! } else ! fail("Sequence is too short for backward reference"); }; --- 350,354 ---- compareSequences(originVec); } ! } else fail("Sequence is too short for backward reference"); }; *************** *** 349,353 **** public void testInsertBefore_case4() { ! //System.err.println("***test case 4 for executeInsertBefore (int, object)"); Vector testVec24 = new Vector(3); testVec24.add(0, new Short((short) 50)); --- 356,361 ---- public void testInsertBefore_case4() { ! //System.err.println("***test case 4 for executeInsertBefore (int, ! // object)"); Vector testVec24 = new Vector(3); testVec24.add(0, new Short((short) 50)); *************** *** 355,359 **** testVec24.add(2, new Short((short) 54)); ! short originVec[] = { 1, 3, 5, 50, 52, 54, 7, 9, 11 }; //System.err.println("originVec: " + originVec); --- 363,367 ---- testVec24.add(2, new Short((short) 54)); ! short originVec[] = {1, 3, 5, 50, 52, 54, 7, 9, 11}; //System.err.println("originVec: " + originVec); *************** *** 377,381 **** short[] originVec = cloneContent(); ! //copy the original content for validation later //System.err.println("originVec: " + originVec); //--------case (5)--------------- --- 385,389 ---- short[] originVec = cloneContent(); ! //copy the original content for validation later //System.err.println("originVec: " + originVec); //--------case (5)--------------- *************** *** 398,402 **** public void testRemoveRange_case1() { ! short originVec[] = { 1, 11 }; //System.err.println("originVec: " + originVec); --- 406,410 ---- public void testRemoveRange_case1() { ! short originVec[] = {1, 11}; //System.err.println("originVec: " + originVec); *************** *** 407,411 **** try { //System.err.println("sseq.size() "+sseq.size()); ! //Remove all the elements in the midde, i.e. exclude the first and last element executeRemoveRange(1, sseq.size() - 2); } catch (ConstraintFailure e) { --- 415,420 ---- try { //System.err.println("sseq.size() "+sseq.size()); ! //Remove all the elements in the midde, i.e. exclude the first and last ! // element executeRemoveRange(1, sseq.size() - 2); } catch (ConstraintFailure e) { *************** *** 415,420 **** compareSequences(originVec); } ! } else ! fail("Sequence is too short to remove a subset of it"); }; --- 424,428 ---- compareSequences(originVec); } ! } else fail("Sequence is too short to remove a subset of it"); }; *************** *** 435,439 **** public void testRemoveRange_case3() { ! short originVec[] = { 1, 3, 5, 9, 11 }; //System.err.println("originVec: " + originVec); --- 443,447 ---- public void testRemoveRange_case3() { ! short originVec[] = {1, 3, 5, 9, 11}; //System.err.println("originVec: " + originVec); *************** *** 452,456 **** public void testRemoveRange_case5() { ! short originArr[] = { 3, 5, 7, 9, 11 }; try { executeRemoveRange(0, 0); --- 460,464 ---- public void testRemoveRange_case5() { ! short originArr[] = {3, 5, 7, 9, 11}; try { executeRemoveRange(0, 0); *************** *** 464,468 **** public void testRemoveRange_case4() { ! short originArr[] = { 1, 3, 5, 7, 9, 11 }; try { executeRemoveRange(0, sseq.size() + 5); --- 472,476 ---- public void testRemoveRange_case4() { ! short originArr[] = {1, 3, 5, 7, 9, 11}; try { executeRemoveRange(0, sseq.size() + 5); *************** *** 483,492 **** public void testReplaceRange_case1() { ! short originVec[] = { 8, 3, 5, 7, 9, 11 }; //System.err.println("originVec: " + originVec); //--------case (1)--------------- //replace the first element with an integer 8 ! //System.err.println("test case 1 for executeReplaceRange(int, int, Object)"); try { executeReplaceRange(0, 0, new Short((short) 8)); --- 491,501 ---- public void testReplaceRange_case1() { ! short originVec[] = {8, 3, 5, 7, 9, 11}; //System.err.println("originVec: " + originVec); //--------case (1)--------------- //replace the first element with an integer 8 ! //System.err.println("test case 1 for executeReplaceRange(int, int, ! // Object)"); try { executeReplaceRange(0, 0, new Short((short) 8)); *************** *** 503,507 **** public void testReplaceRange_case2() { ! //--------case (2)--------------- // Create a vector for insert // the vector contains 3 elements --- 512,516 ---- public void testReplaceRange_case2() { ! //--------case (2)--------------- // Create a vector for insert // the vector contains 3 elements *************** *** 510,514 **** testVec.add(1, new Short((short) 44)); testVec.add(2, new Short((short) 46)); ! short originVec[] = { 42, 44, 46, 3, 5, 7, 9, 11 }; try { --- 519,523 ---- testVec.add(1, new Short((short) 44)); testVec.add(2, new Short((short) 46)); ! short originVec[] = {42, 44, 46, 3, 5, 7, 9, 11}; try { *************** *** 523,532 **** public void testReplaceRange_case3() { ! short originVec[] = { 1, 5 }; //System.err.println("originVec: " + originVec); ! //--------case (3)--------------- if (sseq.size() > 3) { ! // System.err.println("test case 3 for executeReplaceRange(int, int, Object)"); try { --- 532,542 ---- public void testReplaceRange_case3() { ! short originVec[] = {1, 5}; //System.err.println("originVec: " + originVec); ! //--------case (3)--------------- if (sseq.size() > 3) { ! // System.err.println("test case 3 for executeReplaceRange(int, int, ! // Object)"); try { *************** *** 537,542 **** compareSequences(originVec); } ! } else ! fail("Sequence is too short to replace a subset of it"); }; --- 547,551 ---- compareSequences(originVec); } ! } else fail("Sequence is too short to replace a subset of it"); }; *************** *** 544,550 **** public void testReplaceRange_case4() { ! //--------case (4)--------------- if (sseq.size() > 3) { ! //System.err.println("test case 4 for executeReplaceRange(int, int, Object)"); //System.err.println("sseq.vec: "+sseq.vec); // Create a vector for insert --- 553,560 ---- public void testReplaceRange_case4() { ! //--------case (4)--------------- if (sseq.size() > 3) { ! //System.err.println("test case 4 for executeReplaceRange(int, int, ! // Object)"); //System.err.println("sseq.vec: "+sseq.vec); // Create a vector for insert *************** *** 556,560 **** testVec.add(3, new Short((short) 17)); ! short originVec[] = { 1, 11, 13, 15, 17 }; //System.err.println("finally originVec: "+originVec); --- 566,570 ---- testVec.add(3, new Short((short) 17)); ! short originVec[] = {1, 11, 13, 15, 17}; //System.err.println("finally originVec: "+originVec); *************** *** 566,571 **** compareSequences(originVec); } ! } else ! fail("Sequence is too short to replace a subset of it"); }; --- 576,580 ---- compareSequences(originVec); } ! } else fail("Sequence is too short to replace a subset of it"); }; *************** *** 575,579 **** //--------case (5)--------------- ! //System.err.println("test case 5 for executeReplaceRange(int, int, Object)"); try { executeReplaceRange(0, sseq.size() + 6, new Short((short) 8)); --- 584,589 ---- //--------case (5)--------------- ! //System.err.println("test case 5 for executeReplaceRange(int, int, ! // Object)"); try { executeReplaceRange(0, sseq.size() + 6, new Short((short) 8)); *************** *** 594,603 **** public void testReplaceRange_case1back() { ! short originVec[] = { 1, 3, 5, 7, 9, 8 }; //System.err.println("originVec: " + originVec); //--------case (1)--------------- //replace the last element with an integer 8 ! //System.err.println("test case 1 (backward reference) for executeReplaceRange(int, int, Object)"); try { executeReplaceRange(-1, -1, new Short((short) 8)); --- 604,614 ---- public void testReplaceRange_case1back() { ! short originVec[] = {1, 3, 5, 7, 9, 8}; //System.err.println("originVec: " + originVec); //--------case (1)--------------- //replace the last element with an integer 8 ! //System.err.println("test case 1 (backward reference) for ! // executeReplaceRange(int, int, Object)"); try { executeReplaceRange(-1, -1, new Short((short) 8)); *************** *** 612,617 **** public void testReplaceRange_case2back() { ! //--------case (2)--------------- ! //System.err.println("test case 2 (backward reference) for executeReplaceRange(int, int, Object)"); // Create a vector for insert // the vector contains 3 elements --- 623,62... [truncated message content] |