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.
48 lines
1.8 KiB
C#
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));
|
|
|
|
}
|
|
}
|
|
} |