您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

34 行
1.0 KiB

using NUnit.Framework;
using UnityEngine.Experimental.Perception.Randomization.Samplers;
namespace RandomizationTests.SamplerTests
{
[TestFixture]
public class AnimationCurveSamplerTestsBase : SamplerTestsBase<AnimationCurveSampler>
{
public AnimationCurveSamplerTestsBase()
{
m_BaseSampler = new AnimationCurveSampler();
}
[Test]
public void SamplesInRange()
{
var min = m_Sampler.distributionCurve.keys[0].time;
var max = m_Sampler.distributionCurve.keys[m_Sampler.distributionCurve.length - 1].time;
var samples = new float[k_TestSampleCount];
for (var i = 0; i < samples.Length; i++)
{
samples[i] = m_Sampler.Sample();
}
Assert.AreEqual(samples.Length, k_TestSampleCount);
for (var i = 0; i < samples.Length; i++)
{
Assert.GreaterOrEqual(samples[i], min);
Assert.LessOrEqual(samples[i], max);
}
}
}
}