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

function DocumentType()
{
   var tests = new Array (core0001DT(), core0002DT(), core0003DT(),
                core0004DT(), core0005DT(), core0006DT());

   return tests;
}

//------------------------ test case core-0001DT ------------------------
//
// Testing feature - The "name" attribute contains the name of the DTD.
//
// Testing approach - Retrieve the Document Type for this document and examine
//                    its "name" attribute.  It should be set to "staff".
//
// Semantic Requirements: 1
//
// Last modification date - May 3, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0001DT()
 {
   var computedValue = "";
   var expectedValue = "staff"
   var testNode = "";

    results = new testResults("Core0001DT");

    results.description = "The \"name\" attribute contains the name of the "+
                          "DTD.";
//
// Retrieve the targeted data. 
//
    testNode = getDocType();
    computedValue = testNode.name;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0001DT --------------------------
//
//--------------------------- test case core-0002DT ---------------------------
//
// Testing feature - The "entities" attribute is a NamedNodeMap that contains 
//                   the general entities for this document.
//
// Testing approach - Retrieve the DocumentType node for this document and
//                    create a NamedNodeMap of all its entities.  The entire
//                    map is then traversed and the names of the entities
//                    retrieved.  There should be five entities total.  
//                    duplicates should be ignored.
//
// Semantic Requirements: 2 
//
// Last modification date - May 3, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0002DT()
 {
   var computedValue = "";
   var expectedValue = "ent1 ent2 ent3 ent4 ent5 "; 
   var testNode = "";
   var entityList = "";

    results = new testResults("Core000DT");

    results.description = "The \"entities\" attribute contains a NamedNodeMap "+
                          "of all the entities for this document.";
//
// Retrieve the targeted data and access its "entities" attribute.
//
    testNode = getDocType();
    entityList = testNode.entities;
//
// Retrieve each of the entities in the list.
//
    for (var index = 0;index < entityList.length; index++)
         computedValue += entityList.item(index).nodeName+" ";
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0002DT --------------------------
//
//--------------------------- test case core-0003DT ---------------------------
//
// Testing feature - Duplicate entities are ignored.
//
// Testing approach - Retrieve the DocumentType node for this document
//                    and create a NamedNodeMap of all its entities.
//                    The entity named "ent1" is defined twice and therefore
//                    the last one should be ignored. 
//
// Semantic Requirements: 3 
//
// Last modification date - May 3, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0003DT()
 {
   var computedValue = "";
   var expectedValue = 5;
   var testNode = "";
   var entList = "";

    results = new testResults("Core0003DT");

    results.description = "Duplicate entities are discarded.";
//
// Retrieve the targeted data.
//
    testNode = getDocType();
    entList = testNode.entities;
//
// All duplicates should be discared.  List should have only 5 items. 
//
    computedValue = entList.length;
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0003DT --------------------------
//
//--------------------------- test case core-0004DT ---------------------------
//
// Testing feature - Every node in the map returned by the "entities"
//                   attribute implements the Entity interface.
//
// Testing approach - Retrieve the DocumentType node for this document and
//                    create a NamedNodeMap object of all the entities 
//                    defined in it.  Traverse the entire list and examine
//                    the nodeType of each node in the list.
//
// Semantic Requirements: 4 
//
// Last modification date - May 3, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0004DT()
 {
   var testName = "core-0004DT";
   var computedValue = "";
   var expectedValue = "6 6 6 6 6 ";
   var testNode = "";
   var entList = "";

    results = new testResults("Core0004DT");

    results.description = "Each node in the NamedNodeMap object returned by "+
                          "\entities\" interface implements the Entity "+
                          "interface.";
//
// Retrieve the targeted data.
//
     testNode = getDocType();
     entList = testNode.entities; 
//
// Access each element in the list and retrieve its type.
//
     for (var index = 0; index < entList.length; index++)
        computedValue += entList.item(index).nodeType+" ";
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0004DT --------------------------
//
//--------------------------- test case core-0005NT ---------------------------
//
// Testing feature - The "notations" attribute is a NamedNodeMap that contains
//                    all the notations declared in the DTD.
//
// Testing approach - Retrieve the DocumentType node for this document and
//                    create a NamedNodeMap object of all the notations.
//                    There should be two items in the list (notation1 and
//                    notation2)
//
// Semantic Requirements: 5 
//
// Last modification date - May 3, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0005DT()
 {
   var computedValue = "";
   var expectedValue = "notation1 notation2 ";
   var testNode = "";
   var notationList = "";

    results = new testResults("Core0005DT");

    results.description = "The \"notations\" attribute is NamedNodeMap that "+
                          "contains all the notations for this document.";
//
// Retrieve the targeted data and access its "notations" attribute.
//
    testNode = getDocType();
    notationList = testNode.notations;
//
// Retrieve each item in the list.
//
    for (var index = 0;index < notationList.length;index++)
      computedValue += notationList.item(index).nodeName+" ";
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0005DT --------------------------
//
//--------------------------- test case core-0006DT ---------------------------
//
// Testing feature - Every node in the map returned by the "notations" 
//                   attribute implements the Notation interface.
//
// Testing approach - Retrieve the DocumentType node for this document and
//                    create a NamedNodeMap object of all the notations
//                    defined in it.  Traverse the entire list and examine the
//                    nodeType of each node in the list.
//
// Semantic Requirements: 6
//
// Last modification date - May 3, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------

 function core0006DT()
 {
   var computedValue = "";
   var expectedValue = "12 12 ";
   var testNode = "";
   var NotationList = "";

    results = new testResults("Core0006DT");

    results.description = "Each node in the NamedNodeMap object returned by ";
                          "the \"notations\" attribute implements the ";
                          "Notation interface.";
//
// Retrieve the targeted data.
//
     testNode = getDocType();
     entList = testNode.notations;
//
// Access each element in the list and retrieve its type.
//
     for (var index = 0; index < entList.length; index++)
        computedValue += entList.item(index).nodeType+" ";
//
// Write out results
//
    results.expected = expectedValue;
    results.actual = computedValue;

    return results;
}

//------------------------ End test case core-0006DT --------------------------