use of android.support.test.filters.SmallTest in project AnyMemo by helloworld1.
the class CardProviderTest method testGetRandomCards.
@SmallTest
@Test
public void testGetRandomCards() {
ContentResolver cr = getContext().getContentResolver();
Cursor cursor = cr.query(Uri.parse("content://" + AUTHORITY + "/" + TestHelper.SAMPLE_DB_NAME + "/random/10"), null, null, null, null);
assertEquals(10, cursor.getCount());
}
use of android.support.test.filters.SmallTest in project AnyMemo by helloworld1.
the class LearnQueuingManagerTest method testGetNewCardQueuingWithoutCategory.
@SmallTest
@Test
public void testGetNewCardQueuingWithoutCategory() throws Exception {
QueueManager queueManager = new LearnQueueManager.Builder(getContext(), TestHelper.SAMPLE_DB_PATH).setLearnQueueSize(10).setFilterCategory(null).setCacheSize(50).build();
Card cqueue = queueManager.dequeue();
assertEquals(1, (int) cqueue.getId());
queueManager.release();
}
use of android.support.test.filters.SmallTest in project AnyMemo by helloworld1.
the class QuizQueuingManagerTest method testUpdateCard.
@SmallTest
@Test
public void testUpdateCard() throws Exception {
Scheduler mockScheduler = mock(Scheduler.class);
// Create a quiz start the quiz size 3 from card 5
QueueManager queueManager = new QuizQueueManager.Builder().setDbOpenHelper(helper).setQuizSize(3).setStartCardOrd(5).setScheduler(mockScheduler).build();
Card card5 = queueManager.dequeue();
queueManager.remove(card5);
assertEquals(5, (int) card5.getOrdinal());
when(mockScheduler.isCardLearned(card5.getLearningData())).thenReturn(true);
queueManager.update(card5);
Card card6 = queueManager.dequeue();
queueManager.remove(card6);
assertEquals(6, (int) card6.getOrdinal());
when(mockScheduler.isCardLearned(card6.getLearningData())).thenReturn(false);
queueManager.update(card6);
Card card7 = queueManager.dequeue();
queueManager.remove(card7);
assertEquals(7, (int) card7.getOrdinal());
when(mockScheduler.isCardLearned(card7.getLearningData())).thenReturn(true);
queueManager.update(card7);
// Now cards in the queue is the card we failed
// and we succeed this time
Card card6Again = queueManager.dequeue();
queueManager.remove(card6Again);
assertEquals(6, (int) card6Again.getOrdinal());
when(mockScheduler.isCardLearned(card6.getLearningData())).thenReturn(true);
queueManager.update(card6Again);
// No cards in the queue
Card nullCard = queueManager.dequeue();
assertNull(nullCard);
}
use of android.support.test.filters.SmallTest in project AnyMemo by helloworld1.
the class QuizQueuingManagerTest method testFilterByGroup.
@SmallTest
@Test
public void testFilterByGroup() throws Exception {
// Create a quiz start the quiz size 3 from card 5
QueueManager queueManager = new QuizQueueManager.Builder().setDbOpenHelper(helper).setQuizSize(3).setStartCardOrd(5).build();
Card card5 = queueManager.dequeue();
queueManager.remove(card5);
assertEquals(5, (int) card5.getOrdinal());
Card card6 = queueManager.dequeue();
queueManager.remove(card6);
assertEquals(6, (int) card6.getOrdinal());
Card card7 = queueManager.dequeue();
queueManager.remove(card7);
assertEquals(7, (int) card7.getOrdinal());
// No cards in the queue
Card nullCard = queueManager.dequeue();
assertNull(nullCard);
}
use of android.support.test.filters.SmallTest in project AnyMemo by helloworld1.
the class DefaultSchedulerTest method testScheduleForReviewardSuccess.
@SmallTest
@Test
public void testScheduleForReviewardSuccess() {
LearningData newLd = defaultScheduler.schedule(forReviewCardLearningData, 5, false);
assertFalse(defaultScheduler.isCardForReview(newLd));
assertFalse(defaultScheduler.isCardNew(newLd));
assertTrue(defaultScheduler.isCardLearned(newLd));
}
Aggregations