Re: [flexcoders] Testing for XML equality

2010-01-06 Thread Paul Andrews
Davis Ford wrote: Why does this test fail? Is there any way to test for equality that ignores the ordering of elements -- which shouldn't technically matter? [Test] public function testXmlEquality():void { var xml1:XML = a b/b c/c /a;

Re: [flexcoders] Testing for XML equality

2010-01-06 Thread Davis Ford
Hi Paul, I don't believe this is correct for ActionScript3. Strict equality is the === operator which compares object instances. == should test for equality. If you change the test to this... [Test] public function testXmlEquality():void { var xml1:XML = a

Re: [flexcoders] Testing for XML equality

2010-01-06 Thread Davis Ford
eh..that wasn't supposed to be in there -- copy/paste hackery... xml1.normalize(); xml2.normalize();

Re: [flexcoders] Testing for XML equality

2010-01-06 Thread Paul Andrews
Davis Ford wrote: Hi Paul, I don't believe this is correct for ActionScript3. Strict equality is the === operator which compares object instances. == should test for equality. I tried (in Flash).. var objA:Object = {a:1}; var objB:Object = {a:1}; trace(objA==objB); // false var

Re: [flexcoders] Testing for XML equality

2010-01-06 Thread Davis Ford
I found a solution: import mx.utils.ObjectUtil; Assert.assertTrue(ObjectUtil.compare(xml1, xml2) == 0); That does the trick. Regards, Davis On Wed, Jan 6, 2010 at 8:20 PM, Paul Andrews p...@ipauland.com wrote: Davis Ford wrote: Hi Paul, I don't believe this is correct for

RE: [flexcoders] Testing for XML equality

2010-01-06 Thread Gordon Smith
...@yahoogroups.com] On Behalf Of Davis Ford Sent: Wednesday, January 06, 2010 5:22 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Testing for XML equality I found a solution: import mx.utils.ObjectUtil; Assert.assertTrue(ObjectUtil.compare(xml1, xml2) == 0); That does the trick. Regards

Re: [flexcoders] Testing for XML equality

2010-01-06 Thread Davis Ford
Of *Davis Ford *Sent:* Wednesday, January 06, 2010 5:22 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Testing for XML equality I found a solution: import mx.utils.ObjectUtil; Assert.assertTrue(ObjectUtil.compare(xml1, xml2) == 0); That does the trick. Regards