浏览代码

Simplified non-unity tests

/usim-randomization
Steven Leal 4 年前
当前提交
ee210c29
共有 6 个文件被更改,包括 47 次插入59 次删除
  1. 15
      com.unity.perception/Tests/Runtime/Randomization/CategoricalParameterTests.cs
  2. 10
      com.unity.perception/Tests/Runtime/Randomization/ParameterConfigurationTests.cs
  3. 5
      com.unity.perception/Tests/Runtime/Randomization/ParameterTests.cs
  4. 25
      com.unity.perception/Tests/Runtime/Randomization/SamplerTests.cs
  5. 46
      com.unity.perception/Tests/Runtime/Randomization/ScenarioTests.cs
  6. 5
      com.unity.perception/Tests/Runtime/Randomization/StructParameterTests.cs

15
com.unity.perception/Tests/Runtime/Randomization/CategoricalParameterTests.cs


Object.DestroyImmediate(m_TestObject);
}
[UnityTest]
public IEnumerator NegativeProbabilitiesTest()
[Test]
public void NegativeProbabilitiesTest()
yield return null;
[UnityTest]
public IEnumerator DifferentOptionAndProbabilityCounts()
[Test]
public void DifferentOptionAndProbabilityCounts()
yield return null;
[UnityTest]
public IEnumerator ZeroSumProbability()
[Test]
public void ZeroSumProbability()
yield return null;
}
}
}

10
com.unity.perception/Tests/Runtime/Randomization/ParameterConfigurationTests.cs


Object.DestroyImmediate(m_TestObject);
}
[UnityTest]
public IEnumerator CheckForParametersWithSameNameTest()
[Test]
public void CheckForParametersWithSameNameTest()
{
var config = m_TestObject.AddComponent<ParameterConfiguration>();
var param1 = config.AddParameter<FloatParameter>();

Assert.Throws<ParameterConfigurationException>(() => config.ValidateParameters());
yield return null;
[UnityTest]
public IEnumerator AddingNonParameterTypesTest()
[Test]
public void AddingNonParameterTypesTest()
yield return null;
}
[UnityTest]

5
com.unity.perception/Tests/Runtime/Randomization/ParameterTests.cs


Object.DestroyImmediate(m_TestObject);
}
[UnityTest]
public IEnumerator NullSamplersTest()
[Test]
public void NullSamplersTest()
{
foreach (var parameter in m_Parameters)
{

yield return null;
}
}
}

25
com.unity.perception/Tests/Runtime/Randomization/SamplerTests.cs


NativeSamplesInRange(sampler);
}
[UnityTest]
public IEnumerator UniformSamplesInRangeTest()
[Test]
public void UniformSamplesInRangeTest()
yield return null;
[UnityTest]
public IEnumerator NormalSamplesInRangeTest()
[Test]
public void NormalSamplesInRangeTest()
yield return null;
[UnityTest]
public IEnumerator ConstantSamplerTest()
[Test]
public void ConstantSamplerTest()
{
var constantSampler = new ConstantSampler();
var samples = SamplerUtility.GenerateSamples(constantSampler, k_TestSampleCount);

yield return null;
[UnityTest]
public IEnumerator PlaceholderRangeThrowsExceptionsWhenSamplingTest()
[Test]
public void PlaceholderRangeThrowsExceptionsWhenSamplingTest()
yield return null;
[UnityTest]
public IEnumerator CatchInvalidSamplerRangeTest()
[Test]
public void CatchInvalidSamplerRangeTest()
yield return null;
}
}
}

46
com.unity.perception/Tests/Runtime/Randomization/ScenarioTests.cs


// ReSharper disable once Unity.InefficientPropertyAccess
Assert.AreEqual(initialPosition, transform.position);
}
//
// [UnityTest]
// public IEnumerator StartNewDatasetSequenceEveryIteration()
// {
// yield return CreateNewScenario();
// m_Scenario.constants.framesPerIteration = 2;
// m_Scenario.constants.totalIterations = 2;
//
// var perceptionCamera = m_TestObject.AddComponent<PerceptionCamera>();
// perceptionCamera.startTime = 0;
//
// // Skip first frame
// yield return new WaitForEndOfFrame();
// Assert.AreEqual(DatasetCapture.SimulationState.SequenceTime, 0);
//
// // Second frame, first iteration
// yield return new WaitForEndOfFrame();
// Assert.AreEqual(DatasetCapture.SimulationState.SequenceTime, perceptionCamera.period);
//
// // Third frame, second iteration, SequenceTime has been reset
// yield return new WaitForEndOfFrame();
// Assert.AreEqual(DatasetCapture.SimulationState.SequenceTime, 0);
// }
[UnityTest]
public IEnumerator StartNewDatasetSequenceEveryIteration()
{
yield return CreateNewScenario();
m_Scenario.constants.framesPerIteration = 2;
m_Scenario.constants.totalIterations = 2;
var perceptionCamera = m_TestObject.AddComponent<PerceptionCamera>();
perceptionCamera.startTime = 0;
// Skip first frame
yield return new WaitForEndOfFrame();
Assert.AreEqual(DatasetCapture.SimulationState.SequenceTime, 0);
// Second frame, first iteration
yield return new WaitForEndOfFrame();
Assert.AreEqual(DatasetCapture.SimulationState.SequenceTime, perceptionCamera.period);
// Third frame, second iteration, SequenceTime has been reset
yield return new WaitForEndOfFrame();
Assert.AreEqual(DatasetCapture.SimulationState.SequenceTime, 0);
}
}
}

5
com.unity.perception/Tests/Runtime/Randomization/StructParameterTests.cs


Object.DestroyImmediate(m_TestObject);
}
[UnityTest]
public IEnumerator EquivalentManagedAndNativeSamples()
[Test]
public void EquivalentManagedAndNativeSamples()
yield return null;
}
}

正在加载...
取消
保存