diff options
Diffstat (limited to 'tests/unit/SpacedRepetitionModel/SRModel_showGrades_test.cpp')
-rw-r--r-- | tests/unit/SpacedRepetitionModel/SRModel_showGrades_test.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/unit/SpacedRepetitionModel/SRModel_showGrades_test.cpp b/tests/unit/SpacedRepetitionModel/SRModel_showGrades_test.cpp new file mode 100644 index 0000000..2fd0675 --- /dev/null +++ b/tests/unit/SpacedRepetitionModel/SRModel_showGrades_test.cpp @@ -0,0 +1,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); +} |