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

31 行
916 B

using NUnit.Framework;
using UnityEngine.Experimental.Perception.Randomization.Samplers;
namespace RandomizationTests.SamplerTests
{
[TestFixture]
public class UniformSamplerTestsBase : SamplerTestsBase<UniformSampler>
{
public UniformSamplerTestsBase()
{
m_BaseSampler = new UniformSampler(0f, 1f);
}
[Test]
public void SamplesInRange()
{
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], m_Sampler.range.minimum);
Assert.LessOrEqual(samples[i], m_Sampler.range.maximum);
}
}
}
}