Prefer high-performing distractors
This commit is contained in:
@@ -35,6 +35,41 @@ public sealed class ChoicePoolTests
|
||||
Assert.Single(response.ReviewFollowups);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HigherSelectionRatesIncreaseDistractorPresentationFrequency()
|
||||
{
|
||||
var question = BuildQuestion(9);
|
||||
var rates = question.Choices.ToDictionary(choice => choice.Id, _ => 0);
|
||||
rates["B"] = 100;
|
||||
var random = new Random(12345);
|
||||
var counts = question.Choices.ToDictionary(choice => choice.Id, _ => 0);
|
||||
|
||||
for (var iteration = 0; iteration < 2000; iteration++)
|
||||
{
|
||||
foreach (var id in ChoicePoolSelector.SelectChoiceIds(question, rates, random))
|
||||
counts[id]++;
|
||||
}
|
||||
|
||||
Assert.All(question.Choices.Where(choice => choice.Id is not "A" and not "B"),
|
||||
choice => Assert.True(counts["B"] > counts[choice.Id]));
|
||||
Assert.Equal(2000, counts["A"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MissingSelectionRatesStillAllowDifferentDistractorSets()
|
||||
{
|
||||
var question = BuildQuestion(9);
|
||||
var random = new Random(9876);
|
||||
var sets = Enumerable.Range(0, 40)
|
||||
.Select(_ => string.Join(",", ChoicePoolSelector.SelectChoiceIds(
|
||||
question,
|
||||
new Dictionary<string, int>(),
|
||||
random).Order()))
|
||||
.ToHashSet();
|
||||
|
||||
Assert.True(sets.Count > 1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExamReviewContainsOnlyChoicesPresentedDuringTheExam()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user