您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
42 行
1.1 KiB
42 行
1.1 KiB
using NUnit.Framework;
|
|
using UnityEngine;
|
|
using UnityEngine.Perception.Randomization.Parameters;
|
|
|
|
namespace RandomizationTests.ParameterTests
|
|
{
|
|
[TestFixture]
|
|
public class CategoricalParameterTests
|
|
{
|
|
GameObject m_TestObject;
|
|
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
m_TestObject = new GameObject();
|
|
}
|
|
|
|
[TearDown]
|
|
public void TearDown()
|
|
{
|
|
Object.DestroyImmediate(m_TestObject);
|
|
}
|
|
|
|
[Test]
|
|
public void NegativeProbabilities()
|
|
{
|
|
var parameter = new StringParameter();
|
|
parameter.AddOption("option1", 1f);
|
|
parameter.AddOption("option2", -1f);
|
|
Assert.Throws<ParameterValidationException>(() => parameter.Validate());
|
|
}
|
|
|
|
[Test]
|
|
public void ZeroSumProbability()
|
|
{
|
|
var parameter = new StringParameter();
|
|
parameter.AddOption("option1", 0f);
|
|
parameter.AddOption("option2", 0f);
|
|
Assert.Throws<ParameterValidationException>(() => parameter.Validate());
|
|
}
|
|
}
|
|
}
|