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