From d5b37be950ce30507ae1155f7ef8732dcb06c07d Mon Sep 17 00:00:00 2001 From: hideki Date: Tue, 16 Feb 2016 22:34:35 -0800 Subject: [PATCH] Added Unit test for Android Issue 782 - https://github.com/couchbase/couchbase-lite-android/issues/782 --- .../com/couchbase/cbforest/C4DatabaseTest.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/androidTest/java/com/couchbase/cbforest/C4DatabaseTest.java b/src/androidTest/java/com/couchbase/cbforest/C4DatabaseTest.java index 30cc8eb..6e0331a 100644 --- a/src/androidTest/java/com/couchbase/cbforest/C4DatabaseTest.java +++ b/src/androidTest/java/com/couchbase/cbforest/C4DatabaseTest.java @@ -227,6 +227,18 @@ public void testCreateMultipleRevisions() throws ForestException { } public void testInsertRevisionWithHistory() throws ForestException { + _testInsertRevisionWithHistory(20); + } + + public void testInsertRevisionWith512History() throws ForestException { + _testInsertRevisionWithHistory(512); + } + + public void testInsertRevisionWith1024History() throws ForestException { + _testInsertRevisionWithHistory(1024); + } + + public void _testInsertRevisionWithHistory(int kHistoryCount) throws ForestException { String kBody2 = "{\"ok\":\"go\"}"; createRev(kDocID, kRevID, kBody.getBytes()); createRev(kDocID, kRev2ID, kBody2.getBytes()); @@ -236,9 +248,8 @@ public void testInsertRevisionWithHistory() throws ForestException { // Add 18 revisions; the last two entries in the history repeat the two existing revs: Random r = new Random(); - int kHistoryCount = 20; List revIDs = new ArrayList(); - for(int i = kHistoryCount - 1; i >= 2; i--){ + for (int i = kHistoryCount - 1; i >= 2; i--) { String revID = String.format("%d-%08x", i + 1, r.nextInt()); revIDs.add(revID); }