summaryrefslogtreecommitdiff
path: root/tests/unit/SpacedRepetitionModel/SRModel_showGrades_test.cpp
blob: 2fd06750f35dcd911e8e451186cc930174dbff3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "SRModel_showGrades_test.h"

static const StudySettings* ss = StudySettings::inst();

void SRModel_showGrades_Test::SetUp()
{
    StudySettings::inst()->schedRandomness = StudySettings().schedRandomness;
    randomGenerator->setDouble(0.3);    
    cardName = createCard();
}

TEST_F(SRModel_showGrades_Test, new)
    {
    setStudy({StudyRecord::New, 4, ss->initEasiness, 0});
    QList<int> expGrades = {4, 5};
    ASSERT_EQ(expGrades, model.getAvailableGrades());
    }

TEST_F(SRModel_showGrades_Test, learning)
    {
    setStudy({StudyRecord::ShortLearning, 4, ss->initEasiness, ss->unknownInterval});
    QList<int> expGrades = {1, 2, 4, 5};
    ASSERT_EQ(expGrades, model.getAvailableGrades());
    }

TEST_F(SRModel_showGrades_Test, repeating)
    {
    setStudy({StudyRecord::Repeating, 4, ss->initEasiness, 2});
    QList<int> expGrades = {1, 2, 3, 4, 5};
    ASSERT_EQ(expGrades, model.getAvailableGrades());
    }

void SRModel_showGrades_Test::setStudy(const StudyRecord& study)
{
    pack.addStudyRecord(cardName, study);
}