W3C home > Mailing lists > Public > www-dom-ts@w3.org > February 2003

RE: hc_nodecloneattributescopied has deep="false"

From: Curt Arnold <carnold@houston.rr.com>
Date: Mon, 24 Feb 2003 23:21:14 -0600
Message-ID: <3E5AFD4A.7060500@houston.rr.com>
To: www-dom-ts@w3.org

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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:34:06 UTC