* CEV-Eris SMES sprite as RSI. Has been modified so that the light overlay states use alpha blending. * Add tiny glow to SMES display sprite. * Appearances work v2 * More WiP * RoundToLevels works correctly on even level counts now. * SMES -> Smes because MS guidelines. * CEV-Eris APC sprite. * APC visuals. * Reduce SMES scale again to normal levels. * Update submodule
61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using Content.Shared.Utility;
|
|
using NUnit.Framework;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Content.Tests.Shared.Utility
|
|
{
|
|
[Parallelizable]
|
|
[TestFixture]
|
|
[TestOf(typeof(ContentHelpers))]
|
|
public class ContentHelpers_Test
|
|
{
|
|
|
|
public static readonly IEnumerable<(double val, double max, int levels, int expected)> TestData = new(double, double, int, int)[]
|
|
{
|
|
// Testing odd level counts. These are easy.
|
|
(-1, 10, 5, 0),
|
|
( 0, 10, 5, 0),
|
|
( 0.01f, 10, 5, 1),
|
|
( 1, 10, 5, 1),
|
|
( 2, 10, 5, 1),
|
|
( 2.5f, 10, 5, 1),
|
|
( 2.51f, 10, 5, 2),
|
|
( 3, 10, 5, 2),
|
|
( 4, 10, 5, 2),
|
|
( 5, 10, 5, 2),
|
|
( 6, 10, 5, 2),
|
|
( 7, 10, 5, 2),
|
|
( 7.49f, 10, 5, 2),
|
|
( 7.5f, 10, 5, 3),
|
|
( 8, 10, 5, 3),
|
|
( 9, 10, 5, 3),
|
|
(10, 10, 5, 4),
|
|
(11, 10, 5, 4),
|
|
|
|
// Even level counts though..
|
|
( 1, 10, 6, 1),
|
|
( 2, 10, 6, 1),
|
|
( 3, 10, 6, 2),
|
|
( 4, 10, 6, 2),
|
|
( 5, 10, 6, 2),
|
|
( 6, 10, 6, 3),
|
|
( 7, 10, 6, 3),
|
|
( 8, 10, 6, 4),
|
|
( 9, 10, 6, 4),
|
|
(10, 10, 6, 5),
|
|
};
|
|
|
|
[Parallelizable]
|
|
[Test]
|
|
public void Test([ValueSource(nameof(TestData))] (double val, double max, int levels, int expected) data)
|
|
{
|
|
(double val, double max, int levels, int expected) = data;
|
|
Assert.That(ContentHelpers.RoundToLevels(val, max, levels), Is.EqualTo(expected));
|
|
}
|
|
}
|
|
}
|