//**************************************************************************
//
//
//                       National Institute Of Standards and Technology
//                                     DTS Version 1.0
//         
//                                 CharacterData Interface
//**************************************************************************

var i = 2;

function CharacterData()
{
   var tests = new Array (core0001C(), core0002C(), core0003C(),core0004C(),
                core0005C(), core0006C(), core0007C(), core0008C(),
		core0009C(), core0010C(), core0011C(), core0012C(),
                core0013C(), core0014C(), core0015C(), core0015C(),
                core0016C(), core0017C(), core0018C(), core0019C(),
                core0020C(), core0021C(), core0022C(), core0023C(),
                core0024C(), core0025C(), core0026C(), core0027C(),
                core0028C(), core0029C(), core0030C(), core0031C(),
                core0032C(), core0033C(), core0034C(), core0035C(),
                core0036C()); 
  
   return tests;
}

//------------------------ test case core-0001C ------------------------
//
// Testing feature -  The "data" attribute is the character data that
//                    implements this interface.
//
// Testing approach - Retrieve the character data from the second child of
//                    the first employee and invoke its "data" attribute.  The 
//                    attribute should return the actual data.
//                    
// Semantic Requirements: 1
//
// Last modification date - March 10, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0001C()
 {
   var computedValue = "";
   var expectedValue = "Margaret Martin";
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0001C");
   results.description = "The \"data\" attribute is the character data that " +
                         "implements this interface.";
//
// Access the targeted data.
//
      testNode = new nodeObject(FIRST,SECOND);
      testNodeData = testNode.node.firstChild; 
      computedValue = testNodeData.data;
//
// Write out results 
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0001C --------------------------
//
//--------------------------- test case core-0002C ---------------------------
//
// Testing feature -  The "length" attribute contains the number of 16-bit 
//                    units that are available through the data attribute and
//                    the substringData method.  Test for the "data" attribute.
//
// Testing approach - Retrieve the character data from the second child of
//                    the first employee and access its data by using the
//                    "data" attribute.  Finally the "length" attribute
//                    is used on the character data returned by the "data"
//                    attribute to determine the number of 16 bit units in
//                    the data.
//
// Semantic Requirements: 2 
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0002C()
 {
   var computedValue = 0;
   var expectedValue = 15;
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0002C");
   results.description = "The \"length\" attribute is the number of 16-bit units " +
                         "that are available through the \"data\" attribute " +
                         "and the \"substringData\" method (test for \"data\").";
//
// Retrieve the targeted data and invoke its "data" attribute.
//
     testNode = new nodeObject(FIRST,SECOND);
     testNodeData = testNode.node.firstChild;
     computedValue = testNodeData.length;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0002C --------------------------
//
//--------------------------- test case core-0003C ---------------------------
//
// Testing feature -  The "length" attribute contains the number of 16-bit units 
//                    that are available through the data attribute and the
//                    substringData method.  Test for the "substringData"
//                    method.
//
// Testing approach - Retrieve the character data of the second child of the
//                    first employee and access part of the data by using the 
//                    "substringData(offset,count)" method.  Finally the 
//                    "length" attribute is used on the character data 
//                    returned by the "substringData(offset,count)" method 
//                    to determine the number of 16-bit units in the data.
//
// Semantic Requirements: 2
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0003C()
 {
   var computedValue = 0;
   var expectedValue = 8;
   var testNode = "";
   var testNodeData = "";
   var subString = "";

   results = new testResults("Core0003C");
   results.description = "The \"length\" attribute is the number of 16-bit units " +
                         "that are available through the \"data\" attribute " +
                         "and the \"substringData\" method (test for \"substringData\").";
//
// Retrieve the targeted data and invoke its "substringData" method.
//
    testNode = new nodeObject(FIRST,SECOND);
    testNodeData = testNode.node.firstChild;
    subString = testNodeData.substringData(0,8);
    computedValue = subString.length;
//
// write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0003C --------------------------
//
//--------------------------- test case core-0004C ---------------------------
//
// Testing feature -  The "substringData(offset,count)" method returns the
//                    specified substring.
//
// Testing approach - Retrieve the character data from the second child of the
//                    first employee and access part of the data by using the
//                    "substringData(offset,count)" method.  The method should
//                    return the specified substring starting at position
//                    "offset" and extract "count" characters.  The method
//                    method should return the string "Margaret".
//
// Semantic Requirements: 3 
//
// Last modification date - March 10, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0004C()
 {
   var testName = "core-0004C";
   var computedValue = "";
   var expectedValue = "Margaret";
   var tetNode = "";
   var testNodeData = "";

   results = new testResults("Core0004C");
   results.description = "The \"substringData(offset,count)\" method returns the " +
                         "specified substring.";
//
// Retrieve the targeted data and invoke its "substringData" method.
//
     testNode = new nodeObject(FIRST,SECOND);
     testNodeData = testNode.node.firstChild;
     computedValue = testNodeData.substringData(0,8);
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0004C --------------------------
//
//--------------------------- test case core-0005C ---------------------------
//
// Testing feature -  If the sum of "offset" and "count" exceeds "length" then 
//                    the substringData(offset,count) method returns all 
//                    the 16-bit units to the end of the data. 
//
// Testing approach - Retrieve the character data from the second child of the
//                    first employee and access part of the data by using the
//                    "substringData(offset,count)" method with offset = 9 and
//                    count = 10.  The method should return the substring
//                    "Martin" since offset + count > length (19 > 15).
//
// Semantic Requirements: 4 
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0005C()
 {
   var computedValue = "";
   var expectedValue = "Martin";
   testNode = "";
   testNodedata = "";

   results = new testResults("Core0005C");
   results.description = "If the sum of \"offset\" and \"count\" exceeds " +
                         "the value of the \"length\" attribute then the " +
                         "\"substringData(offset,count)\" method returns all " +
                         "the 16-bit units to the end of the data.";
//
// Retrieve the targeted data and invoke its "substringData" method.
//
    testNode = new nodeObject(FIRST,SECOND);
    testNodeData = testNode.node.firstChild;
    computedValue = testNodeData.substringData(9,10);
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0005C --------------------------
//
//--------------------------- test case core-0006C ---------------------------
//
// Testing feature - The "appendData(arg)" method appends a string to the end
//                   of the character data of the node.
//
// Testing approach - Retrieve the character data from the second child of the
//                    first employee.  The "appendData(arg)" method is then 
//                    called with arg = ", Esquire".  The method should append 
//                    the specified data to the already existing character 
//                    data.  The new value of the "length" attribute should 
//                    be 24.
//
// Semantic Requirements: 5 
//
// Last modification date - March 10, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0006C()
 {
   var computedValue = 0;
   var expectedValue = 24;
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0006C");
   results.description = "The \"appendData(arg)\" method appends the specified " +
                         "string to the end of the character data of the node.";
//
// Retrieve targeted data and invoke the "appendData" method.
//
    testNode = new nodeObject(FIRST,SECOND); 
    testNodeData = testNode.node.firstChild;
    testNodeData.appendData(", Esquire");;
    computedValue = testNodeData.length;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    resetData();

    return results;
}

//------------------------ End test case core-0006C --------------------------
//
//--------------------------- test case core-0007C ---------------------------
//
// Testing feature - Upon successful invocation of the "appendData(arg)" 
//                   method, the "data" attribute provides access to the
//                   concatenation of data and the specified DOMString.
//
// Testing approach - Retrieve the character data from the second child of 
//                    the first employee.  The "appendData(arg)" method is 
//                    then called with arg = ", Esquire".  The method should 
//                    append the specified data to the already existing 
//                    character data.  The new value of the "data" attribute 
//                    should be "Margaret Martin, Esquire".
//
// Semantic Requirements: 6 
//
// Last modification date - March 10, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0007C()
 {
   var computedValue = "";
   var expectedValue = "Margaret Martin, Esquire";
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0007C");
   results.description = "Upon successful invocation of the \"appendData(arg)\" " +
                         "method ,the \"data\" attribute provides access " +
                         "to the concatenation of \"data\" and the specified DOMString.";
//
// Retrieve targeted data and invoke its "appendData" method.
//
     testNode = new nodeObject(FIRST,SECOND);
     testNodeData = testNode.node.firstChild
     testNodeData.appendData(", Esquire");;
     computedValue = testNodeData.data;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    resetData();

    return results;
}

//------------------------ End test case core-0007C --------------------------
//
//--------------------------- test case core-0008C ---------------------------
//
// Testing feature - The "insertData(offset,arg)" method insert a string at the
//                   specified 16-bit unit offset.  Insert at the beginning of
//                   the character data.
//
// Testing approach - Retrieve the character data from the second child of 
//                    the first employee.  The "insertData(offset,arg)" 
//                    method is then called with offset = 0 and arg = "Mss.".
//                    The method should insert the string "Mss." at position 
//                    0.  The new value of the character data should be "Mss.
//                    Margaret Martin".
//
// Semantic Requirements: 7 
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0008C()
 {
   var computedValue = "";
   var expectedValue = "Mss. Margaret Martin";
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0008C");
   results.description = "Insert a string at the beginning of character data.";
//
// Retrieve the targeted data and invoke its "insertData" method.
//
    testNode = new nodeObject(FIRST,SECOND);
    testNodeData = testNode.node.firstChild;
    testNodeData.insertData(0,"Mss. ");
    computedValue = testNodeData.data;
//
//    Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    resetData();

    return results;
}

//------------------------ End test case core-0008C --------------------------
//
//--------------------------- test case core-0009C ---------------------------
//
// Testing feature - The "insertData(offset,arg)" method insert a string at the
//                   specified 16-bit units offset.  Insert in the middle of
//                   the character data.
//
// Testing approach - Retrieve the character data from the second child of the
//                    first employee.  The "insertData(offset,arg)" method is 
//                    then called with offset = 9 and arg = "Ann".  The 
//                    method should insert the string "Ann" at position 9.  
//                    The new value of the character data should be 
//                    "Margaret Ann Martin".
//
// Semantic Requirements: 7
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0009C()
 {
   var computedValue = 0;
   var expectedValue = "Margaret Ann Martin";
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0009C");
   results.description = "Insert a character string in the middle of character data."; 
//
// Retrieve targeted data and invoke its "insertData" method.
//
     testNode = new nodeObject(FIRST,SECOND);
     testNodeData = testNode.node.firstChild; 
     testNodeData.insertData(9,"Ann ");
     computedValue = testNodeData.data;
//
//    Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    resetData();

    return results;
}

//------------------------ End test case core-0009C --------------------------
//
//--------------------------- test case core-0010C ---------------------------
//
// Testing feature - The "insertData(offset,arg)" method insert a string at the
//                   specified 16-bit units offset.  Insert at the end of the
//                   character data.
//
// Testing approach - Retrieve the character data from the second child of the
//                    first employee.  The "insertData(offset,arg)" method 
//                    is then called with offset = 14 and arg = ", Esquire".  
//                    The method should insert the string ", Esquire" at 
//                    position 14.  The new value of the character data 
//                    should be "Margaret Martin, Esquire"
//
// Semantic Requirements: 7
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0010C()
 {
   var computedValue = "";
   var expectedValue = "Margaret Martin, Esquire";
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0010C");
   results.description = "Insert a string at the end of character data.";
//
// Retrieve the targeted data and invoke its "insertData" method.
//
    testNode = new nodeObject(FIRST,SECOND);
    testNodeData = testNode.node.firstChild; 
    testNodeData.insertData(15,", Esquire");
    computedValue = testNodeData.data;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    resetData();

    return results;
}

//------------------------ End test case core-0010C --------------------------
//
//--------------------------- test case core-0011C ---------------------------
//
// Testing feature - The "deleteData(offset,count)" method removes a range of
//                   16-bit units from the node.  Delete at the beginning of the
//                   character data.
//
// Testing approach - Retrieve the character data from the last child of the
//                    first employee.  The "deleteData(offset,count)" 
//                    method is then called with offset = 0 and count = 16.  
//                    The method should delete the characters from position 0 
//                    thru position 16.  The new value of the character data 
//                    should be "Dallas, Texas 98551".
//
// Semantic Requirements: 8, 9 
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0011C()
 {
   var computedValue = "";
   var expectedValue = "Dallas, Texas 98551";
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0011C");
   results.description = "Delete character string from beginning of character data.";
//
// Retrieve the targeted data and invoke its "deleteData" method..
//
    testNode = new nodeObject(FIRST,SIXTH);
    testNodeData = testNode.node.firstChild;
    testNodeData.deleteData(0,16);
    computedValue = testNodeData.data;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    resetData();

    return results;
}

//------------------------ End test case core-0011C --------------------------
//
//--------------------------- test case core-0012C ---------------------------
//
// Testing feature - The "deleteData(offset,count)" method removes a range of
//                   16-bit units from the node.  Delete in the middle of
//                   the character data.
//
// Testing approach - Retrieve the character data from the last child of 
//                    the first employee.  The "deleteData(offset,count)"
//                    method is then called with offset = 16 and count = 8.
//                    The method should delete the characters from position 16
//                    thru position 24.  The new value of the character data
//                    should be "1230 North Ave. Texas 98551".
//
// Semantic Requirements: 8, 9
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0012C()
 {
   var computedValue = "";
   var expectedValue = "1230 North Ave. Texas 98551";
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0012C");
   results.description = "Delete character string from the middle of character data.";
//
// Retrieve the targeted data and invoke its "deleteData" method.
//
    testNode = new nodeObject(FIRST,SIXTH);
    testNodeData = testNode.node.firstChild;
    testNodeData.deleteData(16,8);
    computedValue = testNodeData.data;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    resetData();

    return results;
}

//------------------------ End test case core-0012C --------------------------
//
//--------------------------- test case core-0013C ---------------------------
//
// Testing feature - The "deleteData(offset,count)" method removes a range of
//                   16-bit units from the node.  Delete at the end of the
//                   character data.
//
// Testing approach - Retrieve the character data from the last child of 
//                    the first employee.  The "deleteData(offset,count)"
//                    method is then called with offset = 30 and count = 5.
//                    The method should delete the characters from position 30 
//                    thru position 35.  The new value of the character data
//                    should be "1230 North Ave. Dallas, Texas".
//
// Semantic Requirements: 8, 9
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0013C()
 {
   var computedValue = "";
   var expectedValue = "1230 North Ave. Dallas, Texas ";
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0013C");
   results.description = "Delete character string from the end of character data.";
//
// Retrieve the targeted data and invoke its "deleteData" method.
//
    testNode = new nodeObject(FIRST,SIXTH);
    testNodeData = testNode.node.firstChild;
    testNodeData.deleteData(30,5);
    computedValue = testNodeData.data;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    resetData();

    return results;
}

//------------------------ End test case core-0013C --------------------------
//
//--------------------------- test case core-0014C ---------------------------
//
// Testing feature - Upon successful invocation of the 
//                   "deleteData(offset,count)" method, the data and length 
//                   attributes reflect that change.
//
// Testing approach - Retrieve the character data of the last child of the
//                    first employee.  The "deleteData(offset,count)"
//                    method is then called with offset = 30 and count = 5.
//                    The method should delete the characters from position 30 
//                    thru position 35.  The new value of the character data
//                    should be "1230 North Ave. Dallas, Texas" (the data
//                    attribute) and its length attribute should be 30.  This
//                    new values should be reflected immediately upon
//                    its invocation. 
//
// Semantic Requirements: 9
//
// Last modification date - March 11, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0014C()
 {
   var computedValue = "";
   var expectedValue = "1230 North Ave. Dallas, Texas 30";
   var tesNode = "";
   var testNodeData = "";

   results = new testResults("Core0014C");
   results.description = "Data and length attributes are updated as a result " +
                         "of the \"deleteData(offset, count)\" method.";
//
// Retrieve the targeted data and invoke its "deleteData" attribute.
//
     testNode = new nodeObject(FIRST,SIXTH);
     testNodeData = testNode.node.firstChild;
     testNodeData.deleteData(30,5);
     computedValue += testNodeData.data;
     computedValue += testNodeData.length;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    resetData();

    return results;
}

//------------------------ End test case core-0014C --------------------------
//
//--------------------------- test case core-0015C ---------------------------
//
// Testing feature - If the sum of the offset and count attributes (from the
//                   deleteData method) is greater than the length of the 
//                   character data then all the 16-bit units from the offset 
//                   to the end of the data are deleted.
//
// Testing approach - Retrieve the character data from the last child of the
//                    first employee.  The "deleteData(offset,count)"
//                    method is then called with offset = 4 and count = 50.
//                    The method should delete the characters from position 4
//                    to the end of the data since offset + count (50+4) is
//                    greater than the length of the character data (35).  
//                    The new value for the character data should be "1230".
//
// Semantic Requirements: 10 
//
// Last modification date - November 23, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0015C()
 {
   var computedValue = "";
   var expectedValue = "1230";
   var testNode = "";
   var testNodeData = "";

   results = new testResults("Core0015C");
   results.description = "If the sum of \"offset\" and \"count\" exceeds the " +
                         "length of the character data then all the " +
                         "16-bit units from the offset thru the end of the " +
                         "data are removed.
"; // // Retrieve the targeted data and invoke its "deleteData" method. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; testNodeData.deleteData(4,50); computedValue = testNodeData.data; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0015C -------------------------- // //--------------------------- test case core-0016C --------------------------- // // Testing feature - The "replaceData(offset,count,arg)" method replace the // characters starting at the specified 16-bit units with the // specified string. Test for replacement at the // beginning of the data. // // Testing approach - Retrieve the character data from the last child of the // first employee. The "replaceData(offset,count,arg)" // method is then called with offset = 0 and count = 4 and // arg = "2500". The method should replace the first four // characters of the character data with "2500". // // Semantic Requirements: 11 // // Last modification date - November 23, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0016C() { var computedValue = 0; var expectedValue = "2500 North Ave. Dallas, Texas 98551" var testNode = ""; var testNodeData = ""; results = new testResults("Core0016C"); results.description = "Replace a character string at the beginning of character data."; // // Retrieve the targeted data and invoke its "replaceData" method . // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; testNodeData.replaceData(0,4,"2500"); computedValue = testNodeData.data; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0016C -------------------------- // //--------------------------- test case core-0017C --------------------------- // Testing feature - The "replaceData(offset,count,arg)" method replace the // characters starting at the specified 16-bit units with the // specified string. Test for replacement in the // middle of the data. // // Testing approach - Retrieve the character data from the last child of the // first employee. The "replaceData(offset,count,arg)" // method is then called with offset = 5 and count = 5 and // arg = "South". The method should replace characters // five thru nine of the character data with "South". // // Semantic Requirements: 11 // // Last modification date - November 23, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0017C() { var computedValue = ""; var expectedValue = "1230 South Ave. Dallas, Texas 98551" var testNode = ""; var testNodeData = ""; results = new testResults("Core0017C"); results.description = "Replace a character string in the middle of character data."; // // Retrieve the targeted data and invoke its "replaceData" method. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; testNodeData.replaceData(5,5,"South"); computedValue = testNodeData.data; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0017C -------------------------- // //--------------------------- test case core-0018C --------------------------- // // Testing feature - The "replaceData(offset,count,arg)" method replace the // characters starting at the specified 16-bit units with the // specified string. Test for replacement at the // end of the data. // // Testing approach - Retrieve the character data from the last child of the // first employee. The "replaceData(offset,count,arg)" // method is then called with offset = 30 and count = 5 and // arg = "98665". The method should replace characters // 30 thru 34 of the character data with "98665". // // Semantic Requirements: 11 // // Last modification date - November 23, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0018C() { var computedValue = 0; var expectedValue = "1230 North Ave. Dallas, Texas 98665"; var testNode = ""; var testNodeData = ""; results = new testResults("Core0018C"); results.description = "Replace a character substring at the end of character data."; // // Retrieve the targeted data and invoke its "replaceData" method. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; testNodeData.replaceData(30,5,"98665"); computedValue = testNodeData.data; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0018C -------------------------- // //--------------------------- test case core-0019C --------------------------- // // Testing feature - The "replaceData(offset,count,arg)" method replace the // characters starting at the specified 16-bit units with the // specified string. Test situation where the length of // the arg string is greater than the specified offset. // // Testing approach - Retrieve the character data from the last child of the // first employee. The "replaceData(offset,count,arg)" // method is then called with offset = 0 and count = 4 and // arg = "260030". The method should replace characters // one thru four with the string "260030". Note that the // length of the specified string is greater than the // specified offset. // // Semantic Requirements: 11 // // Last modification date - November 23, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0019C() { var computedValue = ""; var expectedValue = "260030 North Ave. Dallas, Texas 98551"; var testNode = ""; var testNodeData = ""; results = new testResults("Core0019C"); results.description = "Checks \"replaceData(offset,count,arg)\" method when " + "length of arg > count."; // // Retrieve targeted data and invoke its "replaceData" method. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; testNodeData.replaceData(0,4,"260030"); computedValue = testNodeData.data; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData() return results; } //------------------------ End test case core-0019C -------------------------- // //--------------------------- test case core-0020C --------------------------- // // Testing feature - If the sum of offset and count exceeds length then all // the 16-bit units to the end of data are replaced. // // Testing approach - Retrieve the character data from the last child of the // first employee. The "replaceData(offset,count,arg)" // method is then called with offset = 0 and count = 50 and // arg = "2600". The method should replace all the // characters in the character data with "2600". This // is because the sum of offset and count exceeds the // length of the character data. // // Semantic Requirements: 12 // // Last modification date - November 23, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0020C() { var testName = "core-0020C"; var computedValue = ""; var expectedValue = "2600"; var testNode = ""; var testNodeData = ""; results = new testResults("Core0020C"); results.description = "If the sum of offset and count exceeds the length " + "of the character data then the \"replaceData(offset,count,arg)\" " + "method replaces all the 16-bit units to the end of the data."; // // Retrieve the targeted data and invoke its "replaceData" method. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; testNodeData.replaceData(0,50,"2600"); computedValue = testNodeData.data; // // Write out results // results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0020C -------------------------- // //--------------------------- test case core-0021C --------------------------- // // Testing feature - The "data" attribute raises a // NO_MODIFICATION_ALLOWED_ERR DOMException when // this node is readonly. // // Testing approach - Retrieve the character data from the first // EntityReference node of the last child of the second // employee and attempt to set its "data" attribute. Since // the the descendants of EntityReference nodes are readonly, // the desired exception should be raised. // // Semantic Requirements: 13 // // Last modification date - April 6, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0021C() { var computedValue = ""; var testNode = ""; var readOnlyText = ""; var expectedValue = NO_MODIFICATION_ALLOWED_ERR; results = new testResults("Core0021C"); results.description = "The \"data\" attribute raises a NO_MODIFICATION_ALLOWED_ERR " + "DOMException when this node is readonly."; // // Retrieve targeted data. // testNode = new nodeObject(SECOND,SIXTH); readOnlyText = testNode.node.firstChild.firstChild; // // Attempt to modify the "data" attribute should raise exception. // try { readOnlyText.data = "ABCD"; } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0021C -------------------------- // //--------------------------- test case core-0022C --------------------------- // // Testing feature - The "appendData(arg) method raises a // NO_MODIFICATION_ALLOWED_ERR DOMException when // this node is readonly. // // Testing approach - Retrieve the textual data from the the first // EntityReference node of the last child of the // second employee and attempt to append data to it. // Descendants of EntityReference nodes are readonly // nodes and therefore the desired exception should be // raised. // // Semantic Requirements: 14 // // Last modification date - April 6, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0022C() { var computedValue = ""; var testNode = ""; var readOnlyNode = ""; var expectedValue = NO_MODIFICATION_ALLOWED_ERR; results = new testResults("Core0022C"); results.description = "The \"appendData(arg)\" method raises a " + "NO_MODIFICATION_ALLOWED_ERR DOMException when this " + "node is readonly."; // // Retrieve the targeted data. // testNode = new nodeObject(SECOND,SIXTH); readOnlyNode = testNode.node.firstChild.firstChild; // // Attempt to append data to a readonly node should raise an exception. // try { readOnlyNode.appendData("002"); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0022C -------------------------- // //--------------------------- test case core-0023C --------------------------- // // Testing feature - The "insertData(offset,arg) method raises a // NO_MODIFICATION_ALLOWED_ERR DOMException when // this node is readonly. // // Testing approach - Retrieve the Text data of the first EntityReference // node from the last child of the second employee and // attempt to insert data into it. Since the descendants // of EntityReference nodes are readonly, the desired // exception should be raised. // // Semantic Requirements: 15 // // Last modification date - April 6, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0023C() { var computedValue = ""; var testNode = ""; var readOnlyNode = ""; var expectedValue = NO_MODIFICATION_ALLOWED_ERR; results = new testResults("Core0023C"); results.description = "The \"insertData(offset,arg)\" method raises a " + "NO_MODIFICATION_ALLOWED_ERR DOMException when this " + "node is readonly."; // // Retrieve the targeted data // testNode = new nodeObject(SECOND,SIXTH); readOnlyNode = testNode.node.firstChild.firstChild; // // Attempt to insert data into a readonly node should raise an exception. // try { readOnlyNode.insertData(2,"ABCD"); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0023C -------------------------- // //--------------------------- test case core-0024C --------------------------- // // Testing feature - The "deleteData(offset,count) method raises a // NO_MODIFICATION_ALLOWED_ERR DOMException when // ths is readonly. // // Testing approach - Retrieve the textual data of the the first // EntityReference node from the last child of the // second employee and attempt to delete data from it. // Since the descendants of EntityReference nodes are // readonly, the desired exception should be raised. // // Semantic Requirements: 16 // // Last modification date - April 6, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0024C() { var computedValue = ""; var readOnlyNode = ""; var testNode = ""; var expectedValue = NO_MODIFICATION_ALLOWED_ERR; results = new testResults("Core0024C"); results.description = "The \"deleteData(offset,count)\" method raises a " + "NO_MODIFICATION_ALLOWED_ERR DOMException when this " + "node is readonly."; // // Retrieve the targeted data. // testNode = new nodeObject(SECOND,SIXTH); readOnlyNode = testNode.node.firstChild.firstChild; // // Attempt to delete data from a readonly node should raise an // exception. // try { readOnlyNode.deleteData(2,4); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0024C -------------------------- // //--------------------------- test case core-0025C --------------------------- // // Testing feature - The "replaceData(offset,count,arg) method raises a // NO_MODIFICATION_ALLOWED_ERR DOMException when // this node is readonly. // // Testing approach - Retrieve the textual data of the first EntityReference // node from the last child of the second employee and // attempt to replace data from it. Since the descendants // of EntityReference nodes are readonly, the desired // exception should be raised. // // Semantic Requirements: 17 // // Last modification date - April 6, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0025C() { var computedValue = ""; var readOnlyNode = ""; var testNode = ""; var expectedValue = NO_MODIFICATION_ALLOWED_ERR; results = new testResults("Core0025C"); results.description = "The \"replaceData(offset,count,arg)\" method raises a " + "NO_MODIFICATION_ALLOWED_ERR DOMException " + "when this node is readonly."; // // Retrieve the targeted data. // testNode = new nodeObject(SECOND,SIXTH); readOnlyNode = testNode.node.firstChild.firstChild; // // Attempt to replace data from a readonly node should raise an // exception. // try { readOnlyNode.replaceData(2,4,"ABCD"); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0025C -------------------------- // //--------------------------- test case core-0026C --------------------------- // // Testing feature - The "substringData(offset,count)" method raises an // INDEX_SIZE_ERR DOMException if the specified offset is // negative. // // Testing approach - Retrieve the character data of the last child of the // of the first employee and invoke its // "substringData(offset,count)" method with offset = -5 // count = 3. It should raise the desired exception since // the offset is negative. // // Semantic Requirements: 19 // // Last modification date - March 12, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0026C() { var computedValue = ""; var returnedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0026C"); results.description = "The \"substringData(offset,count)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified " + "offset is negative."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // A negative offset value should raise and exception. // try { returnedValue = testNodeData.substringData(-5,3); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0026C -------------------------- // //--------------------------- test case core-0027C --------------------------- // // Testing feature - The "substringData(offset,count)" method raises an // INDEX_SIZE_ERR DOMException if the specified offset is // greater than the number of 16-bit units in the "data" // attribute. // // Testing approach - Retrieve the character data of the last child of the // first employee and invoke its // "substringData(offset,count)" method with offset = 40 and // count = 3. The value of the offset is greater than that // one of the "data" attribute, therefore the desired // exception should be raised. // // Semantic Requirements: 20 // // Last modification date - March 12, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0027C() { var computedValue = ""; var returnedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0027C"); results.description = "The \"substringData(offset,count)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified " + "offset is greater than the number of 16-bit units " + "in the \"data\" attribute."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // Offset greater than number of characters in data should raise an // exception. // try { returnedValue = testNodeData.substringData(40,3); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0027C -------------------------- // //--------------------------- test case core-0028C --------------------------- // // Testing feature - The "substringData(offset,count)" method raises an // INDEX_SIZE_ERR DOMException if the count is negative // // Testing approach - Retrieve the character data of the last child of the // first employee and invoke its // "substringData(offset,count)" method with offset = 10 // and count = -3. Since the value of count is negative, // the desired exception should be raised. // // Semantic Requirements: 21 // // Last modification date - March 12, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0028C() { var computedValue = ""; var returnedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0028C"); results.description = "The \"substringData(offset,count)\" method raises an " + "INDEX_SIZE_ERR DOMException if the count is negative."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // A negative value for "count" should raise an exception. // try { returnedValue = testNodeData.substringData(10,-3); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; return results; } //------------------------ End test case core-0028C -------------------------- // //--------------------------- test case core-0029C --------------------------- // // Testing feature - The "deleteData(offset,count)" method raises an // INDEX_SIZE_ERR DOMException if the specified offset is // negative. // // Testing approach - Retrieve the character data of the last child of the // first employee and invoke its "deleteData(offset,count)" // method with offset = -5 and count = 3. The value of the // offset is negative and therefore the desired exception // should be raised. // // Semantic Requirements: 22 // // Last modification date - March 12, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0029C() { var computedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0029C"); results.description = "The \"deleteData(offset,count)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified " + "offset is negative."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // Invoke "deleteData(offset,count)" method with negative offset should // should raise an excetion. // try { testNodeData.deleteData(-5,3); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0029C -------------------------- // //--------------------------- test case core-0030C --------------------------- // // Testing feature - The "deleteData(offset,count)" method raises an // INDEX_SIZE_ERR DOMException if the specified offset is // greater than the number of characters in the "data" // attribute. // // Testing approach - Retrieve the character data of the last child of the // first employee and invoke its "deleteData(offset,count)" // method with offset = 40 and count = 3. The value of the // offset is greater than the number of characters in the // "data" attribute (35) and therefore the intended // exception should be raised. // // Semantic Requirements: 23 // // Last modification date - March 12, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0030C() { var computedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0030C"); results.description = "The \"deleteData(offset,count)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified " + "offset is greater than the number of characters " + "in the \"data\" attribute."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // Invocation of "deleteData(offset,count)" method with offset > data // attribute should raise and exception. // try { testNodeData.deleteData(40,3); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0030C -------------------------- // //--------------------------- test case core-0031C --------------------------- // // Testing feature - The "deleteData(offset,count)" method raises an // INDEX_SIZE_ERR DOMException if the specified count is // negative. // // Testing approach - Retrieve the character data of the last child of the // first employee and invoke its "deleteData(offset,count)" // method with offset = 10 and count = -3. The value // of the specified count is negative and therefore the // intended exception should be raised. // // Semantic Requirements: 24 // // Last modification date - March 12, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0031C() { var computedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0031C"); results.description = "The \"deleteData(offset,count)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified " + "count is negative."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // Invocation of "deleteData(offset,count)" method with count < 0 // should raise and exception. // try { testNodeData.deleteData(10,-3); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0031C -------------------------- // //--------------------------- test case core-0032C --------------------------- // // Testing feature - The "replaceData(offset,count,arg)" method raises an // INDEX_SIZE_ERR DOMException if the specified offset is // negative. // // Testing approach - Retrieve the character data of the last child of the // first employee and invoke its // "replaceData(offset,count,arg)" method with // offset = -5 and count = 3 and arg = "ABC". The value // of the offset is negative and therefore the desired // exception should be raised. // // Semantic Requirements: 25 // // Last modification date - March 12, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0032C() { var computedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0032C"); results.description = "The \"replaceData(offset,count,arg)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified " + "offset is negative."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // Invocation of "replaceData(offset,count,arg)" method offset < 0 // should raise an exception. // try { testNodeData.replaceData(-5,3,"ABC"); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0032C -------------------------- // //--------------------------- test case core-0033C --------------------------- // // Testing feature - The "replaceData(offset,count,arg)" method raises an // INDEX_SIZE_ERR DOMException if the specified offset is // greater than the number of 16-bit units in the "data" // attribute. // // Testing approach - Retrieve the character data of the last child of the // first employee and invoke its // "replaceData(offset,count,arg)" method with offset = 40, // count = 3 and arg = "ABC". The value of the offset is // greater than the number of characters in the "data" // attribute (35) and therefore the intended exception // should be raised. // // Semantic Requirements: 26 // // Last modification date - November 23, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0033C() { var computedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0033C"); results.description = "The \"replaceData(offset,count,arg)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified " + "offset is greater than the number of 16-bit units " + "in the \"data\" attribute."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // Invocation of "replaceData(offset,count,arg)" method with offset > data // attribute should raise and exception. // try { testNodeData.replaceData(40,3,"ABC"); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0033C -------------------------- // //--------------------------- test case core-0034C --------------------------- // // Testing feature - The "replaceData(offset,count,arg)" method raises an // INDEX_SIZE_ERR DOMException if the specified count is // negative. // // Testing approach - Retrieve the character data of the last child of the // first employee and invoke its // "replaceData(offset,count,arg)" method with offset = 10, // count = -3 and arg = "ABC". The value of the specified // count is negative and therefore the intended exception // should be raised. // // Semantic Requirements: 27 // // Last modification date - March 12, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0034C() { var computedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0034C"); results.description = "The \"replaceData(offset,count,arg)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified " + "count is negative."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // Invocation of "replaceData(offset,count,arg)" method with count < 0 // should raise an exception. // try { testNodeData.replaceData(10,-3,"ABC"); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0034C -------------------------- // //--------------------------- test case core-0035C --------------------------- // // Testing feature - The "insertData(offset,arg)" method raises an // INDEX_SIZE_ERR DOMException if the specified offset is // negative. // // Testing approach - Retrieve the character data from the last child of the // first employee and invoke its "insertData(offset,arg)" // method with offset = -5 arg = "ABC". The value // of the offset is negative and therefore the desired // exception should be raised. // // Semantic Requirements: 28 // // Last modification date - March 12, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0035C() { var computedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0035C"); results.description = "The \"insertData(offset,arg)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified offset is negative."; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // Invocation of insertData(offset,arg)" method with offset < 0 // should raise an exception. // try { testNodeData.insertData(-5,"ABC"); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0035C -------------------------- // //--------------------------- test case core-0036C --------------------------- // // Testing feature - The "insertData(offset,arg)" method raises an // INDEX_SIZE_ERR DOMException if the specified offset is // greater than the number of 16-bit units in the "data" // attribute. // // Testing approach - Retrieve the character data from the last child of the // first employee and invoke its "insertData(offset,arg)" // method with offset = 40 and arg = "ABC". The value of // the offset is greater than the number of characters in // the "data" attribute(35) and therefore the intended // exception should be raised. // // Semantic Requirements: 29 // // Last modification date - November 23, 1999 // // Written by: Carmelo Montanez //---------------------------------------------------------------------------- function core0036C() { var computedValue = ""; var testNode = ""; var testNodeData = ""; var expectedValue = INDEX_SIZE_ERR; results = new testResults("Core0036C"); results.description = "The \"insertData(offset,arg)\" method raises an " + "INDEX_SIZE_ERR DOMException if the specified " + "offset is greater than the number of 16-bit units " + "in the \"data\" attribute.
"; // // Retrieve the targeted data. // testNode = new nodeObject(FIRST,SIXTH); testNodeData = testNode.node.firstChild; // // Invocation of "insertData(offset arg)" method with offset > data // attribute should raise an exception. // try { testNodeData.insertData(40,"ABC"); } catch(DOMException) { computedValue = DOMException.description; } results.expected = expectedValue; results.actual = computedValue; resetData(); return results; } //------------------------ End test case core-0036C --------------------------