RE: hc_nodecloneattributescopied has deep="false"

Allen, Michael B wrote:

 >Is this test supposed to have deep="false"? In the description it
 >says it should be true but the xml file has:
 >
 ><cloneNode obj="addressNode" deep="false" var="clonedNode"/>
 >
 >PS: Also the order of the expectedResult members is foiling my
 >assertEqualsList function. Not sure if those are supposed to
 >appear in order but it would be nice if you could flip them if it
 >doesn't make any other difference,

The discrepancy between the test description and the body also appears 
in nodecloneattributescopied and has apparently been carried over from 
the original NIST test suite.  This particular test should not be 
affected by the value of the deep parameter.  Unless there are 
objections, I'll change the test description to be consistent with the 
test body.  I do not think that it would be very helpful to have a 
second test where deep really is true.

On the PS, since the expected result is declared as a "Collection" and 
not a "List", assertEquals should do a order insensitive comparison.

The JavaScript production is

function hc_nodecloneattributescopied() {
...
       var result = new Array();

       var expectedResult = new Array();
       expectedResult[0] = "class";
       expectedResult[1] = "title";
...
       for(var _index = 0; _index < attributes.length; _index++) {
       attributeNode = attributes.item(_index);
       attributeName = attributeNode.nodeName;

       result[result.length] = attributeName;

	}
 
assertEqualsCollection("nodeNames",toAutoCaseArray(expectedResult),result);


The Java production is:

    public void runTest() throws Throwable {
...
       java.util.Collection result = new java.util.ArrayList();
       java.util.Collection expectedResult = new java.util.ArrayList();
       expectedResult.add("class");
       expectedResult.add("title");
...
       for (int indexN10061 = 0; indexN10061 < attributes.getLength(); 
indexN10061++) {
           attributeNode = (Node) attributes.item(indexN10061);
           attributeName = attributeNode.getNodeName();
       result.add(attributeName);
         }
       assertEquals("nodeNames", expectedResult, result);
    }

The assertEquals(String, Collection, Collection) and 
assertEqualsCollection() should pass as long as both collections have 
the same number of elements and each element in one collection appears 
once and only once in the other collection.

Received on Tuesday, 25 February 2003 00:21:25 UTC