Prefer high-performing distractors

This commit is contained in:
hz
2026-07-20 02:44:58 -05:00
parent dae3a31b71
commit 121e80b2ea
6 changed files with 152 additions and 20 deletions
+35
View File
@@ -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()
{