< Summary

Information
Class: DatatypeTests.DoubleTests
Assembly: datatypetests.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\Tests\DatatypeTests\Numeric\DoubleTests.cs
Line coverage
100%
Covered lines: 22
Uncovered lines: 0
Coverable lines: 22
Total lines: 88
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\Tests\DatatypeTests\Numeric\DoubleTests.cs

#LineLine coverage
 1using ValidateLib.ErrorsAndWarnings.Errors.Specific;
 2using ValidateLib.Metadata.Descriptors;
 3using ValidateLib.TabularData.Datatypes.NumericDatatypes;
 4
 5namespace DatatypeTests
 6{
 7    public class DoubleTests
 8    {
 9
 10
 11        [Theory]
 12        [InlineData("-3E2")]
 13        [InlineData("4268.22752E11")]
 14        [InlineData("+24.3e-3")]
 15        [InlineData("+3.5")]
 16        [InlineData("12")]
 17        [InlineData("-INF")]
 18        [InlineData("-0")]
 19        [InlineData("NaN")]
 20        public void ValidDoubleWithoutPatternTest(string stringValue)
 121        {
 122            DoubleDT doubledt = new DoubleDT(stringValue);
 123        }
 24
 25        [Theory]
 26        [InlineData("not a double")]
 27        [InlineData("-3E2.4")]
 28        [InlineData("12E")]
 29        [InlineData("NAN")]
 30        [InlineData("")]
 31
 32        public void DoubleWithoutPatternInvalidValues(string stringValue)
 133        {
 134            Assert.Throws<DatatypeValidationError>(() => new DoubleDT(stringValue));
 135        }
 36
 37        [Theory]
 38        [InlineData("+10", ",", ".")]
 39        [InlineData("+10,000,000", ",", ".")]
 40        [InlineData("+10.5", ",", ".")]
 41        [InlineData("-10%", ",", ".")]
 42        [InlineData("-10‰", ",", ".")]
 43        [InlineData("+10,000,000E4", ",", ".")]
 44        [InlineData("+10.5E-3", ",", ".")]
 45        [InlineData("-10E+4", ",", ".")]
 46        [InlineData("+10;5E-3", ",", ";")]
 47
 48        [InlineData("+10", null, ".")]
 49        [InlineData("+10.5", null, ".")]
 50        [InlineData("-10%", null, ".")]
 51        [InlineData("-10‰", null, ".")]
 52        [InlineData("+10.5E6", null, ".")]
 53        [InlineData("-10E+6", null, ".")]
 54        [InlineData("-10E-6", null, ".")]
 55        [InlineData("+10;5E-3", null, ";")]
 56
 57        [InlineData("NaN", null, ".")]
 58        [InlineData("INF", null, ".")]
 59        [InlineData("-INF", null, ".")]
 60        public void DoublelWithFormatWithoutPatternValidValues(string stringValue, string? groupChar, string? decimalCha
 161        {
 162            FormatDescriptor format = new FormatDescriptor
 163            {
 164                groupChar = groupChar,
 165                decimalChar = decimalChar,
 166            };
 67
 168            var doubleDT = new DoubleDT(stringValue, format);
 169        }
 70
 71        [Theory]
 72        [InlineData("not double", ",", ".")]
 73        [InlineData("10,,00", ",", ".")]
 74        [InlineData("not double", null, ".")]
 75
 76        public void DoublelWithFormatWithoutPatternInValidValues(string stringValue, string? groupChar, string? decimalC
 177        {
 178            FormatDescriptor format = new FormatDescriptor
 179            {
 180                groupChar = groupChar,
 181                decimalChar = decimalChar,
 182            };
 83
 184            Assert.Throws<DatatypeValidationError>(() => new DoubleDT(stringValue, format));
 185        }
 86
 87    }
 88}