public void MoreThanEase1() { var breakDownTime = new SatietyTestHelper.TimeRange(5, 10); var nutrientOutputRunTime = new SatietyTestHelper.TimeRange(0, 0); SatietyTestHelper helper = new SatietyTestHelper(this.IsSingle, 5, 60, 0, 0, breakDownTime, nutrientOutputRunTime); var elapseds = helper.Start(); Assert.IsTrue(helper.IsCorrect(elapseds)); }
public void MoreThanEase3() { var breakDownTime = new SatietyTestHelper.TimeRange(0, 10); var nutrientOutputRunTime = new SatietyTestHelper.TimeRange(5, 10); //吃食物的时间间隔为100毫秒 //在1对1模式下,每个养分输出时间为100毫秒 //在1对多模式下,每个养分输出时间为100/n(SatietyTestHelper中n为5,也就是20毫秒) SatietyTestHelper helper = new SatietyTestHelper(this.IsSingle, 5, 100, 0, 0, breakDownTime, nutrientOutputRunTime); var elapseds = helper.Start(); Assert.IsTrue(helper.IsCorrect(elapseds)); }
public void HighLoad1() { var nutrientOutputRunTime = new SatietyTestHelper.TimeRange(0, 0); if (this.IsSingle) { var breakDownTime = new SatietyTestHelper.TimeRange(75, 85); var range = new NumericalRangeInt(80, 0.2f); SatietyTestHelper helper = new SatietyTestHelper(this.IsSingle, 5, 50, 0, 0, breakDownTime, nutrientOutputRunTime); var elapseds = helper.Start(); Assert.IsTrue(range.Contains((int)elapseds.Average())); } else { { var breakDownTime = new SatietyTestHelper.TimeRange(30, 30); //吃食物的时间间隔为100毫秒 //在1对多模式下,每个养分输出时间为100/n(SatietyTestHelper中n为5,也就是20毫秒) //我们设置粉碎时间为30毫秒,但是每粉碎1个食物,可以获得5个养分,这5个养分的输出总时间是100毫秒 //因此,输出的总时间是高于粉碎时间的,那么平均输出时间依然是20毫秒 var range = new NumericalRangeInt(20, 0.2f); SatietyTestHelper helper = new SatietyTestHelper(this.IsSingle, 5, 100, 0, 0, breakDownTime, nutrientOutputRunTime); var elapseds = helper.Start(); var average = (int)elapseds.Average(); Assert.IsTrue(range.Contains(average)); } { var breakDownTime = new SatietyTestHelper.TimeRange(200, 200); //吃食物的时间间隔为100毫秒 //在1对多模式下,每个养分输出时间应该为100/n(SatietyTestHelper中n为5,也就是20毫秒) //但是我们设置粉碎时间为200毫秒,大于吃食物的时间 //那么获取养分的周期应该是200毫秒,每粉碎1个食物,可以获得5个养分,这5个养分的输出间隔应该是40毫秒 var range = new NumericalRangeInt(40, 0.2f); SatietyTestHelper helper = new SatietyTestHelper(this.IsSingle, 5, 100, 0, 0, breakDownTime, nutrientOutputRunTime); var elapseds = helper.Start(); var average = (int)elapseds.Average(); Assert.IsTrue(range.Contains(average)); } } }