Files
QuantEngineByItz/src/dotnet/QuantEngine.Core.Tests/KrxTickNormalizerTests.cs
T
kjh2064 d1278b26ee
Deploy to Production / Build Release Package (push) Failing after 17s
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 5s
Deploy to Production / Deploy to Production Server (push) Has been skipped
Deploy to Production / Post-Deployment Checks (push) Has been skipped
Snapshot Admin Deployment / build-and-deploy (push) Failing after 38s
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 2m19s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
test(dotnet): add 32 xUnit tests for domain calculators (WBS-10.2)
2026-06-29 09:59:56 +09:00

34 lines
1.2 KiB
C#

using Xunit;
using QuantEngine.Core.Domain;
namespace QuantEngine.Core.Tests
{
public class KrxTickNormalizerTests
{
[Theory]
[InlineData(1500, 1)] // < 2000
[InlineData(4500, 5)] // < 5000
[InlineData(15000, 10)] // < 20000
[InlineData(45000, 50)] // < 50000
[InlineData(150000, 100)] // < 200000
[InlineData(450000, 500)] // < 500000
[InlineData(1000000, 1000)]// >= 500000
public void GetTickUnit_PriceRanges_ReturnExpectedTick(double price, int expectedTick)
{
int tick = KrxTickNormalizer.GetTickUnit(price);
Assert.Equal(expectedTick, tick);
}
[Theory]
[InlineData(1500.3, 1500)] // remainder = 0.3 < 0.5 -> round down
[InlineData(1500.7, 1501)] // remainder = 0.7 >= 0.5 -> round up
[InlineData(4502, 4500)] // tick = 5, remainder = 2 < 2.5 -> round down
[InlineData(4503, 4505)] // tick = 5, remainder = 3 >= 2.5 -> round up
public void NormalizeTick_VariousPrices_ReturnNormalizedPrice(double price, double expectedNormalized)
{
double res = KrxTickNormalizer.NormalizeTick(price);
Assert.Equal(expectedNormalized, res);
}
}
}