r9901 - apps/modules/trunk/test/tests
[email protected] Tue, 15 Sep 2009 16:54:36 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090915145436.84D2F3D0E3@mia> |
Author: hannes
Date: 2009-09-15 16:54:36 +0200 (Tue, 15 Sep 2009)
New Revision: 9901
Modified:
apps/modules/trunk/test/tests/HopObjectGroupBy.js
Log:
Make group order test work with oracle sort order
Details at http://dev.helma.org/trac/helma/changeset/9901
Modified: apps/modules/trunk/test/tests/HopObjectGroupBy.js
===================================================================
--- apps/modules/trunk/test/tests/HopObjectGroupBy.js 2009-09-15 14:48:28 UTC (rev 9900)
+++ apps/modules/trunk/test/tests/HopObjectGroupBy.js 2009-09-15 14:54:36 UTC (rev 9901)
@@ -12,7 +12,7 @@
for (var i = 0; i < size; i++) {
var org = new Organisation();
org.name = "Organisation " + i;
- org.country = "C" + i;
+ org.country = "CH" + i.format("0000");
root.organisations.add(org);
}
res.commit();
@@ -71,17 +71,17 @@
function testGroupOrder() {
var org1 = new Organisation();
- org1.country = "AT" + Math.random();
+ org1.country = "AT";
org1.name = "Helma" + Math.random();
root.organisations.add(org1);
var org2 = new Organisation();
- org2.country = "CH" + Math.random();
+ org2.country = "CH01"; // pre-populated items have countries CH0000..C1234
org2.name = "Helma" + Math.random();
root.organisations.add(org2);
var org3 = new Organisation();
- org3.country = "DE" + Math.random();
+ org3.country = "DE";
org3.name = "Helma" + Math.random();
root.organisations.add(org3);
@@ -94,11 +94,16 @@
// make sure that countries and organisations are sorted in decreasing order (as specified in type.properties)
var countries = root.organisationsByCountry.list();
- for (var i=0; i<root.organisationsByCountry.count(); i++) {
- if (i>0) assertTrue(root.organisationsByCountry.get(i-1)._id >= root.organisationsByCountry.get(i)._id)
- for (var j=0; j<root.organisationsByCountry.get(i); j++) {
- if (j>0) assertTrue(root.organisationsByCountry.get(i).get(j-1)._id >= root.organisationsByCountry.get(i).get(j)._id)
+ assertEqual(countries.length, size + 3);
+ for (var i = 0; i < countries.length; i++) {
+ if (i>0) {
+ assertTrue(root.organisationsByCountry.get(i-1).groupname >= root.organisationsByCountry.get(i).groupname);
}
+ for (var j = 0; j < root.organisationsByCountry.get(i); j++) {
+ if (j > 0) {
+ assertTrue(root.organisationsByCountry.get(i).get(j-1).groupname >= root.organisationsByCountry.get(i).get(j).groupname);
+ }
+ }
}
org1.remove();