[Mulgara-svn] r1185 - trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa

pag at mulgara.org pag at mulgara.org
Wed Aug 27 22:39:11 UTC 2008


Author: pag
Date: 2008-08-27 15:39:10 -0700 (Wed, 27 Aug 2008)
New Revision: 1185

Modified:
   trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDateUnitTest.java
Log:
Checking that the SPComparator comparisons are as expected

Modified: trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDateUnitTest.java
===================================================================
--- trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDateUnitTest.java	2008-08-27 22:37:40 UTC (rev 1184)
+++ trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDateUnitTest.java	2008-08-27 22:39:10 UTC (rev 1185)
@@ -35,6 +35,7 @@
 
 // Internal Packages
 import org.mulgara.query.rdf.XSD;
+import org.mulgara.store.stringpool.SPComparator;
 import org.mulgara.util.Constants;
 
 /**
@@ -108,6 +109,7 @@
     suite.addTest(new SPDateUnitTest("testValid"));
     suite.addTest(new SPDateUnitTest("testInvalid"));
     suite.addTest(new SPDateUnitTest("testCompare"));
+    suite.addTest(new SPDateUnitTest("testAvlCompare"));
     suite.addTest(new SPDateUnitTest("testBoundaryDates"));
 
     return suite;
@@ -250,6 +252,22 @@
     assertTrue(t3.compareTo(t3) == 0);
   }
 
+  public void testAvlCompare() throws Exception {
+    // Create a new factory
+    SPDateFactory factory = new SPDateFactory();
+
+    SPDateImpl t1, t2;
+
+    t1 = (SPDateImpl) factory.newSPTypedLiteral(XSD.DATE_URI, "2006-08-23+00:00");
+    t2 = (SPDateImpl) factory.newSPTypedLiteral(XSD.DATE_URI, "2006-08-23");
+
+    assertEquals(0, t1.compareTo(t2));
+
+    SPComparator comparator = SPDateImpl.SPDateComparator.getInstance();
+    assertEquals(1, comparator.compare(t1.getData(), 0, t2.getData(), 0));
+    assertEquals(-1, comparator.compare(t2.getData(), 0, t1.getData(), 0));
+  }
+
   public void testBoundaryDates() throws Exception {
     // Create a new factory
     SPDateFactory factory = new SPDateFactory();




More information about the Mulgara-svn mailing list