Files
tbf/TBFTests/Uncertainty/Calculation/CalculationTableTest.cs
T
michal 1e1f8bf8e6 Refactor uncertainty calculations and update UI functionality
Streamline uncertainty handling by modifying data structures and methods, replacing `SerNo` with a generic `val` array. Introduce `PreviousResultsDlgUncertainty` for expanded result management, and incorporate Excel template handling for uncertainty calculations. Ensure backward compatibility while refining code for clarity and efficiency.
2025-04-17 12:17:01 +02:00

48 lines
1.8 KiB
C#

using System.Collections.Generic;
using JetBrains.Annotations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Results.Uncertainty;
using Results.Uncertainty.Calculation;
using TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl;
namespace TBFTests.Uncertainty.Calculation
{
[TestClass]
[TestSubject(typeof(CalculationTable))]
public class CalculationTableTest
{
[TestMethod]
public void StandardDeviationTest()
{
CalculationTable calculationTable = new CalculationTable();
List<ColumnValue> columnValues = new List<ColumnValue>();
CalculationTable.StandardDeviation(columnValues);
BatchProcessTable batchTable = calculationTable.BatchProcessTable;
batchTable.ProcessTable = new Dictionary<int, ProcessDataLine>();
ProcessDataLine processDataLine = new ProcessDataLine();
processDataLine.InitDefault();
batchTable.ProcessTable.Add(1, processDataLine);
processDataLine = new ProcessDataLine();
processDataLine.InitDefault();
batchTable.ProcessTable.Add(2, processDataLine);
processDataLine = new ProcessDataLine();
processDataLine.InitDefault();
batchTable.ProcessTable.Add(3, processDataLine);
processDataLine = new ProcessDataLine();
processDataLine.InitDefault();
batchTable.ProcessTable.Add(4, processDataLine);
IList<ColumnValue> listMeterValue = batchTable.GetListMeterValue(0, 5);
double standardDeviation = CalculationTable.StandardDeviation(listMeterValue);
//because all are the same shoud be 0
Assert.IsTrue(CommonExcell.AreClose(0, standardDeviation));
}
}
}