diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ATSkewTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ATSkewTests.cs index 3c2633c6..d5fa480c 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ATSkewTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ATSkewTests.cs @@ -22,6 +22,8 @@ public class ATSkewTests : FullCalculatorsTests [TestCase(2, 0)] [TestCase(5, 0)] [TestCase(6, 0.6)] + [TestCase(7, 0)] + [TestCase(8, -1)] public void CalculationTest(int index, double value) { ChainCharacteristicTest(index, Link.NotApplied, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AlphabetCardinalityTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AlphabetCardinalityTests.cs index 4e5ab066..2bff2e23 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AlphabetCardinalityTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AlphabetCardinalityTests.cs @@ -24,6 +24,20 @@ public class AlphabetCardinalityTests : FullCalculatorsTests + /// No intervals test. + /// + /// + /// Full sequence index in . + /// + /// + /// The link. + /// + /// + /// The value. + /// + [TestCase(3, Link.None, 0)] + [TestCase(5, Link.None, 0)] + [TestCase(7, Link.None, 0)] + public void NoIntervalsTest(int index, Link link, double value) + { + ChainCharacteristicTest(index, link, value); + } } diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AlphabeticDepthTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AlphabeticDepthTests.cs index 8ca3645c..d14e2686 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AlphabeticDepthTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AlphabeticDepthTests.cs @@ -26,8 +26,36 @@ public class AlphabeticDepthTests : FullCalculatorsTests [TestCase(0, Link.End, 6.4165)] [TestCase(0, Link.Both, 8.8815)] [TestCase(0, Link.Cycle, 7.7856)] + + [TestCase(2, Link.None, 3.29248125)] + [TestCase(2, Link.Start, 6.649604)] + [TestCase(2, Link.End, 5.877443751)] + [TestCase(2, Link.Both, 9.2345665)] + [TestCase(2, Link.Cycle, 7.5384077985)] + + [TestCase(30, Link.Start, 3.5849625)] public void ChainCalculationTest(int index, Link link, double value) { ChainCharacteristicTest(index, link, value); } + + /// + /// No intervals test. + /// + /// + /// Full sequence index in . + /// + /// + /// The link. + /// + /// + /// The value. + /// + [TestCase(3, Link.None, 0)] + [TestCase(5, Link.None, 0)] + [TestCase(7, Link.None, 0)] + public void NoIntervalsTest(int index, Link link, double value) + { + ChainCharacteristicTest(index, link, value); + } } diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ArithmeticMeanTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ArithmeticMeanTests.cs index 91f261cd..fa7eefef 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ArithmeticMeanTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ArithmeticMeanTests.cs @@ -26,8 +26,36 @@ public class ArithmeticMeanTests : FullCalculatorsTests [TestCase(0, Link.End, 2.4)] [TestCase(0, Link.Both, 2.5385)] [TestCase(0, Link.Cycle, 3)] + + [TestCase(2, Link.None, 2.666666666666667)] + [TestCase(2, Link.Start, 3.2)] + [TestCase(2, Link.End, 2.8)] + [TestCase(2, Link.Both, 3.142857142857)] + [TestCase(2, Link.Cycle, 4)] + + [TestCase(30, Link.Start, 1.8)] public void ChainCalculationTest(int index, Link link, double value) { ChainCharacteristicTest(index, link, value); } + + /// + /// No intervals test. + /// + /// + /// Full sequence index in . + /// + /// + /// The link. + /// + /// + /// The value. + /// + [TestCase(3, Link.None, 0)] + [TestCase(5, Link.None, 0)] + [TestCase(7, Link.None, 0)] + public void NoIntervalsTest(int index, Link link, double value) + { + ChainCharacteristicTest(index, link, value); + } } diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AverageRemotenessATSkewTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AverageRemotenessATSkewTests.cs index 9f221433..e429bb2e 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AverageRemotenessATSkewTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/AverageRemotenessATSkewTests.cs @@ -27,6 +27,11 @@ public class AverageRemotenessATSkewTests : FullCalculatorsTests [TestCase(0, Link.End, 1.017)] [TestCase(0, Link.Both, 1.0828)] [TestCase(0, Link.Cycle, 1.234)] + + [TestCase(2, Link.None, 1.09749375)] + [TestCase(2, Link.Start, 1.3299208)] + [TestCase(2, Link.End, 1.17548874963)] + [TestCase(2, Link.Both, 1.31922378713)] + [TestCase(2, Link.Cycle, 1.5076815597)] + [TestCase(30, Link.Start, 0.7169925)] public void ChainCalculationTest(int index, Link link, double value) { diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/CuttingLengthTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/CuttingLengthTests.cs index e7337cd9..918d0b3f 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/CuttingLengthTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/CuttingLengthTests.cs @@ -21,9 +21,9 @@ public class CuttingLengthTests : FullCalculatorsTests /// /// The value. /// - [TestCase(0, Link.NotApplied, 3)] - public void ChainCalculationTest(int index, Link link, double value) + [TestCase(0, 3)] + public void ChainCalculationTest(int index, double value) { - ChainCharacteristicTest(index, link, value); + ChainCharacteristicTest(index, Link.NotApplied, value); } } diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/CuttingLengthVocabularyEntropyTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/CuttingLengthVocabularyEntropyTests.cs index 5bf514cf..df26ae4d 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/CuttingLengthVocabularyEntropyTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/CuttingLengthVocabularyEntropyTests.cs @@ -21,9 +21,9 @@ public class CuttingLengthVocabularyEntropyTests : FullCalculatorsTests /// The value. /// - [TestCase(0, Link.NotApplied, 3)] - public void CalculationTest(int index, Link link, double value) + [TestCase(0, 3)] + public void CalculationTest(int index, double value) { - ChainCharacteristicTest(index, link, value); + ChainCharacteristicTest(index, Link.NotApplied, value); } } diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/DepthTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/DepthTests.cs index 8f80aa30..903b38e0 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/DepthTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/DepthTests.cs @@ -26,6 +26,14 @@ public class DepthTests : FullCalculatorsTests [TestCase(0, Link.End, 10.1699)] [TestCase(0, Link.Both, 14.0768)] [TestCase(0, Link.Cycle, 12.3399)] + + [TestCase(2, Link.None, 6.5849625)] + [TestCase(2, Link.Start, 13.299208)] + [TestCase(2, Link.End, 11.7548875)] + [TestCase(2, Link.Both, 18.469133)] + [TestCase(2, Link.Cycle, 15.076815597)] + + [TestCase(30, Link.Start, 3.5849625)] public void CalculationTest(int index, Link link, double value) { ChainCharacteristicTest(index, link, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/DescriptiveInformationTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/DescriptiveInformationTests.cs index 0b7ad166..2b5bdd5e 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/DescriptiveInformationTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/DescriptiveInformationTests.cs @@ -26,6 +26,13 @@ public class DescriptiveInformationTests : FullCalculatorsTests /// /// The value. /// - [TestCase(0, Link.NotApplied, 10)] - public void ChainCalculationTest(int index, Link link, double value) + [TestCase(0, 10)] + [TestCase(1, 10)] + [TestCase(2, 10)] + [TestCase(3, 2)] + [TestCase(4, 4)] + [TestCase(5, 4)] + [TestCase(6, 7)] + [TestCase(7, 2)] + [TestCase(8, 4)] + [TestCase(9, 9)] + [TestCase(10, 9)] + [TestCase(11, 9)] + [TestCase(12, 9)] + [TestCase(13, 9)] + [TestCase(14, 9)] + [TestCase(15, 9)] + [TestCase(16, 9)] + [TestCase(17, 9)] + [TestCase(18, 0)] + [TestCase(19, 1)] + [TestCase(20, 1)] + [TestCase(21, 2)] + [TestCase(22, 2)] + [TestCase(24, 2)] + [TestCase(26, 3)] + [TestCase(28, 3)] + public void ChainCalculationTest(int index, double value) { - ChainCharacteristicTest(index, link, value); + ChainCharacteristicTest(index, Link.NotApplied, value); } } diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCRatioTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCRatioTests.cs index 71617f30..60708663 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCRatioTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCRatioTests.cs @@ -19,6 +19,11 @@ public class GCRatioTests : FullCalculatorsTests /// The value. /// [TestCase(1, 40)] + [TestCase(2, 60)] + [TestCase(3, 100)] + [TestCase(4, 100)] + [TestCase(5, 50)] + [TestCase(6, 28.57142857)] public void CalculationTest(int index, double value) { ChainCharacteristicTest(index, Link.NotApplied, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCSkewTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCSkewTests.cs index 70baf987..e572cdee 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCSkewTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCSkewTests.cs @@ -19,6 +19,11 @@ public class GCSkewTests : FullCalculatorsTests /// The value. /// [TestCase(1, 0)] + [TestCase(2, -0.666666666667)] + [TestCase(3, 0)] + [TestCase(4, -1)] + [TestCase(5, 0)] + [TestCase(6, 0)] public void CalculationTest(int index, double value) { ChainCharacteristicTest(index, Link.NotApplied, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCToATRatioTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCToATRatioTests.cs index b94f87e7..64b84dd6 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCToATRatioTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GCToATRatioTests.cs @@ -19,6 +19,11 @@ public class GCToATRatioTests : FullCalculatorsTests /// The value. /// [TestCase(1, 0.6666)] + [TestCase(2, 1.5)] + [TestCase(5, 1)] + [TestCase(6, 0.4)] + [TestCase(7, 0)] + [TestCase(8, 0)] public void CalculationTest(int index, double value) { ChainCharacteristicTest(index, Link.NotApplied, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GeometricMeanTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GeometricMeanTests.cs index d3ae2ada..fefe23c7 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GeometricMeanTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/GeometricMeanTests.cs @@ -26,6 +26,13 @@ public class GeometricMeanTests : FullCalculatorsTests [TestCase(0, Link.End, 2.0237)] [TestCase(0, Link.Both, 2.1182)] [TestCase(0, Link.Cycle, 2.3522)] + + [TestCase(2, Link.None, 2.139826387867)] + [TestCase(2, Link.Start, 2.513888742864)] + [TestCase(2, Link.End, 2.25869387)] + [TestCase(2, Link.Both, 2.4953181811241978)] + [TestCase(2, Link.Cycle, 2.843527111557)] + [TestCase(30, Link.Start, 1.6437518295)] public void CalculationTest(int index, Link link, double value) { diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/IdentificationInformationTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/IdentificationInformationTests.cs index 666c0203..a4128896 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/IdentificationInformationTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/IdentificationInformationTests.cs @@ -26,6 +26,13 @@ public class IdentificationInformationTests : FullCalculatorsTests [TestCase(0, Link.End, 10)] [TestCase(0, Link.Both, 13)] [TestCase(0, Link.Cycle, 10)] + + [TestCase(2, Link.None, 6)] + [TestCase(2, Link.Start, 10)] + [TestCase(2, Link.End, 10)] + [TestCase(2, Link.Both, 14)] + [TestCase(2, Link.Cycle, 10)] public void ChainCalculationTest(int index, Link link, double value) { ChainCharacteristicTest(index, link, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/IntervalsSumTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/IntervalsSumTests.cs index 81fc4aa4..f87496a4 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/IntervalsSumTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/IntervalsSumTests.cs @@ -26,6 +26,12 @@ public class IntervalsSumTests : FullCalculatorsTests [TestCase(0, Link.End, 24)] [TestCase(0, Link.Both, 33)] [TestCase(0, Link.Cycle, 30)] + + [TestCase(2, Link.None, 16)] + [TestCase(2, Link.Start, 32)] + [TestCase(2, Link.End, 28)] + [TestCase(2, Link.Both, 44)] + [TestCase(2, Link.Cycle, 40)] public void ChainCalculationTest(int index, Link link, double value) { ChainCharacteristicTest(index, link, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/LengthTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/LengthTests.cs index 22fde852..851aa72a 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/LengthTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/LengthTests.cs @@ -19,6 +19,25 @@ public class LengthTests : FullCalculatorsTests /// The value. /// [TestCase(0, 10)] + [TestCase(1, 10)] + [TestCase(2, 10)] + [TestCase(3, 2)] + [TestCase(4, 4)] + [TestCase(5, 4)] + [TestCase(6, 7)] + [TestCase(7, 2)] + [TestCase(8, 4)] + [TestCase(9, 9)] + [TestCase(10, 9)] + [TestCase(11, 9)] + [TestCase(12, 9)] + [TestCase(13, 9)] + [TestCase(14, 9)] + [TestCase(15, 9)] + [TestCase(16, 9)] + [TestCase(17, 9)] + [TestCase(18, 10)] + [TestCase(19, 10)] public void ChainCalculationTest(int index, double value) { ChainCharacteristicTest(index, Link.NotApplied, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/LinkedFullCalculatorTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/LinkedFullCalculatorTests.cs index aacc50ba..7e883302 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/LinkedFullCalculatorTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/LinkedFullCalculatorTests.cs @@ -43,4 +43,4 @@ public void CalculationTest(int sequenceIndex, FullCharacteristic type, Link lin double actual = calculator.Calculate(sequences[sequenceIndex]); Assert.That(actual, Is.EqualTo(expected).Within(0.0001d)); } -} \ No newline at end of file +} diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/MKSkewTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/MKSkewTests.cs index 8194fb5e..67ccc5e5 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/MKSkewTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/MKSkewTests.cs @@ -19,6 +19,13 @@ public class MKSkewTests : FullCalculatorsTests /// The value. /// [TestCase(1, 0)] + [TestCase(2, 0.4)] + [TestCase(3, 0)] + [TestCase(4, 1)] + [TestCase(5, 0)] + [TestCase(6, 0.42857142857)] + [TestCase(7, 0)] + [TestCase(8, -1)] public void CalculationTest(int index, double value) { ChainCharacteristicTest(index, Link.NotApplied, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/PeriodicityTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/PeriodicityTests.cs index 88761ebf..11767727 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/PeriodicityTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/PeriodicityTests.cs @@ -26,6 +26,14 @@ public class PeriodicityTests : FullCalculatorsTests [TestCase(0, Link.End, 0.8432)] [TestCase(0, Link.Both, 0.8344)] [TestCase(0, Link.Cycle, 0.7841)] + + [TestCase(2, Link.None, 0.80243489545)] + [TestCase(2, Link.Start, 0.785590232145)] + [TestCase(2, Link.End, 0.806676382)] + [TestCase(2, Link.Both, 0.7939648758)] + [TestCase(2, Link.Cycle, 0.71088177788925)] + + [TestCase(30, Link.Start, 0.91319546)] public void ChainCalculationTest(int index, Link link, double value) { ChainCharacteristicTest(index, link, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ProbabilityTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ProbabilityTests.cs index a20622f8..2a441656 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ProbabilityTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/ProbabilityTests.cs @@ -21,10 +21,20 @@ public class ProbabilityTests : FullCalculatorsTests /// /// The value. /// - [TestCase(0, Link.NotApplied, 1)] - public void ChainCalculationTest(int index, Link link, double value) + [TestCase(0, 1)] + [TestCase(1, 1)] + [TestCase(2, 1)] + [TestCase(18, 0)] + [TestCase(19, 0.1)] + [TestCase(20, 0.1)] + [TestCase(21, 0.2)] + [TestCase(22, 0.2)] + [TestCase(24, 0.2)] + [TestCase(26, 0.3)] + [TestCase(29, 0.1)] + public void ChainCalculationTest(int index, double value) { - ChainCharacteristicTest(index, link, value); + ChainCharacteristicTest(index, Link.NotApplied, value); } /// diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/RYSkewTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/RYSkewTests.cs index 029518d9..26605508 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/RYSkewTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/RYSkewTests.cs @@ -19,6 +19,13 @@ public class RYSkewTests : FullCalculatorsTests /// The value. /// [TestCase(1, 0)] + [TestCase(2, -0.4)] + [TestCase(3, 0)] + [TestCase(4, -1)] + [TestCase(5, 0)] + [TestCase(6, 0.42857142857)] + [TestCase(7, 0)] + [TestCase(8, -1)] public void CalculationTest(int index, double value) { ChainCharacteristicTest(index, Link.NotApplied, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/RegularityTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/RegularityTests.cs index 261e6446..47af5816 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/RegularityTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/RegularityTests.cs @@ -26,6 +26,13 @@ public class RegularityTests : FullCalculatorsTests [TestCase(0, Link.End, 0.8489)] [TestCase(0, Link.Both, 0.8393)] [TestCase(0, Link.Cycle, 0.7917)] + + [TestCase(2, Link.None, 0.924481699264)] + [TestCase(2, Link.Start, 0.848944998)] + [TestCase(2, Link.End, 0.88086479457968535)] + [TestCase(2, Link.Both, 0.86439343863)] + [TestCase(2, Link.Cycle, 0.838985343)] + [TestCase(30, Link.Start, 0.9587)] public void ChainCalculationTest(int index, Link link, double value) { diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/SWSkewTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/SWSkewTests.cs index 819321fd..8ba5a96f 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/SWSkewTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/SWSkewTests.cs @@ -19,7 +19,13 @@ public class SWSkewTests : FullCalculatorsTests /// The value. /// [TestCase(1, -0.2)] - + [TestCase(2, 0.2)] + [TestCase(3, 1)] + [TestCase(4, 1)] + [TestCase(5, 0)] + [TestCase(6, -0.42857142857)] + [TestCase(7, -1)] + [TestCase(8, -1)] public void CalculationTest(int index, double value) { ChainCharacteristicTest(index, Link.NotApplied, value); diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/UniformityTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/UniformityTests.cs index 10ce1e33..6a59d454 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/UniformityTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/UniformityTests.cs @@ -26,6 +26,13 @@ public class UniformityTests : FullCalculatorsTests [TestCase(0, Link.End, 0.2362824857)] [TestCase(0, Link.Both, 0.252818955)] [TestCase(0, Link.Cycle, 0.337)] + + [TestCase(2, Link.None, 0.113283334415)] + [TestCase(2, Link.Start, 0.2362570097771987)] + [TestCase(2, Link.End, 0.18300750037)] + [TestCase(2, Link.Both, 0.2102399737463)] + [TestCase(2, Link.Cycle, 0.25328248774368)] + [TestCase(30, Link.Start, 0.06080123752225)] public void ChainCalculationTest(int index, Link link, double value) { diff --git a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/VolumeTests.cs b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/VolumeTests.cs index 77275e3a..7d636157 100644 --- a/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/VolumeTests.cs +++ b/Libiada.Core.Tests/Core/Characteristics/Calculators/FullCalculators/VolumeTests.cs @@ -26,6 +26,12 @@ public class VolumeTests : FullCalculatorsTests [TestCase(0, Link.End, 1152)] [TestCase(0, Link.Both, 17280)] [TestCase(0, Link.Cycle, 5184)] + + [TestCase(2, Link.None, 96)] + [TestCase(2, Link.Start, 10080)] + [TestCase(2, Link.End, 3456)] + [TestCase(2, Link.Both, 362880)] + [TestCase(2, Link.Cycle, 34560)] public void CalculationTest(int index, Link link, double value) { ChainCharacteristicTest(index, link, value); diff --git a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/AlphabeticAverageRemoteness.cs b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/AlphabeticAverageRemoteness.cs index a8de4e80..ea61c048 100644 --- a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/AlphabeticAverageRemoteness.cs +++ b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/AlphabeticAverageRemoteness.cs @@ -20,8 +20,11 @@ public class AlphabeticAverageRemoteness : IFullCalculator /// public double Calculate(Chain chain, Link link) { - GeometricMean geometricMean = new(); + double geometricMean = new GeometricMean().Calculate(chain, link); + if (geometricMean == 0) return 0; + int alphabetCardinality = chain.Alphabet.Cardinality; - return Math.Log(geometricMean.Calculate(chain, link), alphabetCardinality); + + return Math.Log(geometricMean, alphabetCardinality); } } diff --git a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/ArithmeticMean.cs b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/ArithmeticMean.cs index d408dd89..ae9de244 100644 --- a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/ArithmeticMean.cs +++ b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/ArithmeticMean.cs @@ -22,9 +22,7 @@ public class ArithmeticMean : IFullCalculator public double Calculate(Chain chain, Link link) { double intervalsCount = new IntervalsCount().Calculate(chain, link); - - // if tere are no intervals arithmetic mean is equals to geometric mean - if (intervalsCount == 0) return 1; + if (intervalsCount == 0) return 0; double intervalsSum = new IntervalsSum().Calculate(chain, link); return intervalsSum / intervalsCount; diff --git a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/GeometricMean.cs b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/GeometricMean.cs index 1eed9a4d..c419caa9 100644 --- a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/GeometricMean.cs +++ b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/GeometricMean.cs @@ -21,6 +21,6 @@ public double Calculate(Chain chain, Link link) { double remoteness = new AverageRemoteness().Calculate(chain, link); - return Math.Pow(2, remoteness); + return remoteness == 0 ? 0 : Math.Pow(2, remoteness); } } diff --git a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/IdentificationInformation.cs b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/IdentificationInformation.cs index a3a0070c..9d583774 100644 --- a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/IdentificationInformation.cs +++ b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/IdentificationInformation.cs @@ -34,8 +34,11 @@ public double Calculate(Chain chain, Link link) int alphabetCardinality = chain.Alphabet.Cardinality; for (int i = 0; i < alphabetCardinality; i++) { - double nj = counter.Calculate(chain.CongenericChain(i), link); double arithmeticMean = meanCalculator.Calculate(chain.CongenericChain(i), link); + if (arithmeticMean == 0) continue; + + double nj = counter.Calculate(chain.CongenericChain(i), link); + result += (nj / n) * Math.Log2(arithmeticMean); } diff --git a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/Periodicity.cs b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/Periodicity.cs index 7bac2547..4d6e872e 100644 --- a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/Periodicity.cs +++ b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/Periodicity.cs @@ -20,9 +20,11 @@ public class Periodicity : IFullCalculator /// public double Calculate(Chain chain, Link link) { - double geometricMean = new GeometricMean().Calculate(chain, link); double arithmeticMean = new ArithmeticMean().Calculate(chain, link); + if (arithmeticMean == 0) return 0; + double geometricMean = new GeometricMean().Calculate(chain, link); + return geometricMean / arithmeticMean; } } diff --git a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessDispersion.cs b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessDispersion.cs index 257e6f93..3ae3e1fe 100644 --- a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessDispersion.cs +++ b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessDispersion.cs @@ -29,6 +29,7 @@ public double Calculate(Chain chain, Link link) intervals.AddRange(chain.CongenericChain(i).GetArrangement(link)); } + // calcualting number of intervals of certain length Dictionary intervalsDictionary = intervals .GroupBy(i => i) .ToDictionary(i => i.Key, i => i.Count()); diff --git a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessKurtosis.cs b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessKurtosis.cs index efd07c06..cfa069e6 100644 --- a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessKurtosis.cs +++ b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessKurtosis.cs @@ -29,6 +29,7 @@ public double Calculate(Chain chain, Link link) intervals.AddRange(chain.CongenericChain(i).GetArrangement(link)); } + // calcualting number of intervals of certain length Dictionary intervalsDictionary = intervals .GroupBy(i => i) .ToDictionary(i => i.Key, i => i.Count()); diff --git a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessSkewness.cs b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessSkewness.cs index 1095ffe4..09eb685e 100644 --- a/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessSkewness.cs +++ b/Libiada.Core/Core/Characteristics/Calculators/FullCalculators/RemotenessSkewness.cs @@ -29,6 +29,7 @@ public double Calculate(Chain chain, Link link) intervals.AddRange(chain.CongenericChain(i).GetArrangement(link)); } + // calcualting number of intervals of certain length Dictionary intervalsDictionary = intervals .GroupBy(i => i) .ToDictionary(i => i.Key, i => i.Count());