您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
23 行
667 B
23 行
667 B
using NUnit.Framework;
|
|
|
|
namespace Unity.MLAgents.Tests
|
|
{
|
|
public class UtilitiesTests
|
|
{
|
|
[Test]
|
|
public void TestCumSum()
|
|
{
|
|
var output = Utilities.CumSum(new[] { 1, 2, 3, 10 });
|
|
CollectionAssert.AreEqual(output, new[] { 0, 1, 3, 6, 16 });
|
|
|
|
output = Utilities.CumSum(new int[0]);
|
|
CollectionAssert.AreEqual(output, new[] { 0 });
|
|
|
|
output = Utilities.CumSum(new[] { 100 });
|
|
CollectionAssert.AreEqual(output, new[] { 0, 100 });
|
|
|
|
output = Utilities.CumSum(new[] { -1, 10 });
|
|
CollectionAssert.AreEqual(output, new[] { 0, -1, 9 });
|
|
}
|
|
}
|
|
}
|