Lesson multipliers stay explicit in tests; poor marks and unexcused absences toast and may auto-summon, while illness stays excused.
69 lines
2.1 KiB
C#
69 lines
2.1 KiB
C#
using HSchool.Content;
|
|
|
|
namespace HSchool.Ai.Tests;
|
|
|
|
public class LessonMarkCouplingTests
|
|
{
|
|
private static readonly BehaviorDef Rules = new()
|
|
{
|
|
DefName = "Behavior",
|
|
LessonMarkThresholds = BehaviorDef.DefaultLessonMarkThresholds,
|
|
LessonMarkMax = 40,
|
|
LessonNoTextbookFactor = 0.5f,
|
|
LessonWhisperSkillFactor = 0.4f,
|
|
};
|
|
|
|
[Fact]
|
|
public void WhisperFactor_WorsensMarkVsQuiet()
|
|
{
|
|
var quiet = LessonLearning.Mark(
|
|
LessonLearning.Quality(1f, 0, 100f, 1f, textbookFactor: 1f),
|
|
Rules);
|
|
var whisper = LessonLearning.Mark(
|
|
LessonLearning.Quality(1f, 0, 100f, 1f, textbookFactor: Rules.LessonWhisperSkillFactor),
|
|
Rules);
|
|
|
|
Assert.True(quiet > whisper);
|
|
}
|
|
|
|
[Fact]
|
|
public void NoTextbook_WorsensMarkVsWithTextbook()
|
|
{
|
|
var withBook = LessonLearning.Mark(
|
|
LessonLearning.Quality(1f, 0, 100f, 1f, textbookFactor: 1f),
|
|
Rules);
|
|
var without = LessonLearning.Mark(
|
|
LessonLearning.Quality(1f, 0, 100f, 1f, textbookFactor: Rules.LessonNoTextbookFactor),
|
|
Rules);
|
|
|
|
Assert.True(withBook > without);
|
|
}
|
|
|
|
[Fact]
|
|
public void Hunger_WorsensMarkVsFull()
|
|
{
|
|
var full = LessonLearning.Mark(LessonLearning.Quality(1f, 0, 100f, 1f, 1f), Rules);
|
|
var hungry = LessonLearning.Mark(LessonLearning.Quality(0.2f, 0, 100f, 1f, 1f), Rules);
|
|
|
|
Assert.True(full > hungry);
|
|
}
|
|
|
|
[Fact]
|
|
public void Cold_WorsensMarkVsWarm()
|
|
{
|
|
var warm = LessonLearning.Mark(LessonLearning.Quality(1f, 0, 100f, warmth: 1f, textbookFactor: 1f), Rules);
|
|
var cold = LessonLearning.Mark(LessonLearning.Quality(1f, 0, 100f, warmth: 0.2f, textbookFactor: 1f), Rules);
|
|
|
|
Assert.True(warm > cold);
|
|
}
|
|
|
|
[Fact]
|
|
public void WeakTeacher_WorsensMarkVsStrong()
|
|
{
|
|
var strong = LessonLearning.Mark(LessonLearning.Quality(1f, 0, teacherSkill: 100f, 1f, 1f), Rules);
|
|
var weak = LessonLearning.Mark(LessonLearning.Quality(1f, 0, teacherSkill: 10f, 1f, 1f), Rules);
|
|
|
|
Assert.True(strong > weak);
|
|
}
|
|
}
|