Search in sources :

Example 6 with IndexOffset

use of com.google.firebase.firestore.model.FieldIndex.IndexOffset in project firebase-android-sdk by firebase.

the class FieldIndexTest method indexOffsetAdvancesSeconds.

@Test
public void indexOffsetAdvancesSeconds() {
    IndexOffset actualSuccessor = IndexOffset.createSuccessor(version(1, (int) 1e9 - 1), -1);
    IndexOffset expectedSuccessor = IndexOffset.create(version(2, 0), DocumentKey.empty(), -1);
    assertEquals(expectedSuccessor, actualSuccessor);
}
Also used : IndexOffset(com.google.firebase.firestore.model.FieldIndex.IndexOffset) Test(org.junit.Test)

Example 7 with IndexOffset

use of com.google.firebase.firestore.model.FieldIndex.IndexOffset in project firebase-android-sdk by firebase.

the class FieldIndexTest method indexOffsetComparator.

@Test
public void indexOffsetComparator() {
    IndexOffset docAOffset = IndexOffset.create(version(1), key("foo/a"), -1);
    IndexOffset docBOffset = IndexOffset.create(version(1), key("foo/b"), -1);
    IndexOffset version1Offset = IndexOffset.createSuccessor(version(1), -1);
    IndexOffset docCOffset = IndexOffset.create(version(2), key("foo/c"), -1);
    IndexOffset version2Offset = IndexOffset.createSuccessor(version(2), -1);
    assertEquals(-1, docAOffset.compareTo(docBOffset));
    assertEquals(-1, docAOffset.compareTo(version1Offset));
    assertEquals(-1, version1Offset.compareTo(docCOffset));
    assertEquals(-1, version1Offset.compareTo(version2Offset));
    assertEquals(-1, docCOffset.compareTo(version2Offset));
}
Also used : IndexOffset(com.google.firebase.firestore.model.FieldIndex.IndexOffset) Test(org.junit.Test)

Aggregations

IndexOffset (com.google.firebase.firestore.model.FieldIndex.IndexOffset)7 Test (org.junit.Test)3 DocumentKey (com.google.firebase.firestore.model.DocumentKey)2 FieldIndex (com.google.firebase.firestore.model.FieldIndex)2 Target (com.google.firebase.firestore.core.Target)1 IndexType (com.google.firebase.firestore.local.IndexManager.IndexType)1 Document (com.google.firebase.firestore.model.Document)1 MutableDocument (com.google.firebase.firestore.model.MutableDocument)1 ResourcePath (com.google.firebase.firestore.model.ResourcePath)1 SnapshotVersion (com.google.firebase.firestore.model.SnapshotVersion)1 Collection (java.util.Collection)1 Nullable (javax.annotation.Nullable)1