40 lines
1019 B
Dart
40 lines
1019 B
Dart
import 'package:cyberhybridhub_server/spelling/spelling_progress_policy.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
test('weightForScore never drops below minWeight', () {
|
|
expect(
|
|
SpellingProgressPolicy.weightForScore(100),
|
|
SpellingProgressPolicy.minWeight,
|
|
);
|
|
});
|
|
|
|
test('weightForScore is higher for negative familiarity', () {
|
|
expect(
|
|
SpellingProgressPolicy.weightForScore(-3),
|
|
greaterThan(SpellingProgressPolicy.weightForScore(0)),
|
|
);
|
|
});
|
|
|
|
test('weightForScore is lower for positive familiarity', () {
|
|
expect(
|
|
SpellingProgressPolicy.weightForScore(5),
|
|
lessThan(SpellingProgressPolicy.weightForScore(0)),
|
|
);
|
|
});
|
|
|
|
test('scoreAfterAttempt moves up on correct and down on wrong', () {
|
|
expect(
|
|
SpellingProgressPolicy.scoreAfterAttempt(currentScore: 2, correct: true),
|
|
3,
|
|
);
|
|
expect(
|
|
SpellingProgressPolicy.scoreAfterAttempt(
|
|
currentScore: 2,
|
|
correct: false,
|
|
),
|
|
1,
|
|
);
|
|
});
|
|
}
|