< Summary

Information
Class: DatatypeTests.FloatTests
Assembly: datatypetests.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\Tests\DatatypeTests\Numeric\FloatTests.cs
Line coverage
100%
Covered lines: 22
Uncovered lines: 0
Coverable lines: 22
Total lines: 85
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\FloatTests.cs

#LineLine coverage
 1using ValidateLib.ErrorsAndWarnings.Errors.Specific;
 2using ValidateLib.Metadata.Descriptors;
 3using ValidateLib.TabularData.Datatypes.NumericDatatypes;
 4
 5namespace DatatypeTests
 6{
 7    public class FloatTests
 8    {
 9
 10
 11        [Theory]
 12        [InlineData("-3E2")]
 13        [InlineData("4268.22752E11")]
 14        [InlineData("+24.3e-3")]
 15        [InlineData("+3.5")]
 16        [InlineData("-INF")]
 17        [InlineData("-0")]
 18        [InlineData("NaN")]
 19        public void ValidFloatWithoutPatternTest(string stringValue)
 120        {
 121            FloatDT floatdt = new FloatDT(stringValue);
 122        }
 23
 24        [Theory]
 25        [InlineData("not a float")]
 26        [InlineData("-3E2.4")]
 27        [InlineData("12E")]
 28        [InlineData("NAN")]
 29        [InlineData("")]
 30
 31        public void FloatWithoutPatternInvalidValues(string stringValue)
 132        {
 133            Assert.Throws<DatatypeValidationError>(() => new FloatDT(stringValue));
 134        }
 35
 36        [Theory]
 37        [InlineData("+10", ",", ".")]
 38        [InlineData("+10,000,000", ",", ".")]
 39        [InlineData("+10.5", ",", ".")]
 40        [InlineData("-10%", ",", ".")]
 41        [InlineData("-10‰", ",", ".")]
 42        [InlineData("+10,000,000E4", ",", ".")]
 43        [InlineData("+10;5E-3", ",", ";")]
 44        [InlineData("-10E+4", ",", ".")]
 45
 46        [InlineData("+10", null, ".")]
 47        [InlineData("+10.5", null, ".")]
 48        [InlineData("-10%", null, ".")]
 49        [InlineData("-10‰", null, ".")]
 50        [InlineData("+10.5E6", null, ".")]
 51        [InlineData("-10E+6", null, ".")]
 52        [InlineData("-10E-6", null, ".")]
 53        [InlineData("+10;5E-3", null, ";")]
 54
 55        [InlineData("NaN", null, ".")]
 56        [InlineData("INF", null, ".")]
 57        [InlineData("-INF", null, ".")]
 58        public void DoublelWithFormatWithoutPatternValidValues(string stringValue, string? groupChar, string? decimalCha
 159        {
 160            FormatDescriptor format = new FormatDescriptor
 161            {
 162                groupChar = groupChar,
 163                decimalChar = decimalChar,
 164            };
 65
 166            var floatDT = new DoubleDT(stringValue, format);
 167        }
 68
 69        [Theory]
 70        [InlineData("not float", ",", ".")]
 71        [InlineData("10,,00", ",", ".")]
 72        [InlineData("not float", null, ".")]
 73
 74        public void DoublelWithFormatWithoutPatternInValidValues(string stringValue, string? groupChar, string? decimalC
 175        {
 176            FormatDescriptor format = new FormatDescriptor
 177            {
 178                groupChar = groupChar,
 179                decimalChar = decimalChar,
 180            };
 81
 182            Assert.Throws<DatatypeValidationError>(() => new DoubleDT(stringValue, format));
 183        }
 84    }
 85}