-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support multiple abbreviations (#658)
* Concentration Units (mixtures/solutions) Added the following Concentration Units: - MassConcentration: SI = kg/m3, typically mg/l - VolumeConcentration : dimensionless, typically % - MassFraction: SI = kg/kg, typically mg/kg Modified the existing Molarity unit: - Some operations that were originally based on the Density units now use the MassConcentration units instead (Note: despite the fact that they share the same measurement units- the Density is a distnct QuantyType from the MassConcentration) - Removed all operators involving Molarity from the Density units Defined some basic operations that were missing from the AmountOfSubstance/MolarMass/Mass units Defined the triangular operations involving Mass/Molar/Volume concentrations (& the corresponding component's Density & MolarMass) All unit tests included most were defined by actual chemists(which I AM NOT). Note: one of the tests (QuantityIFormattableTests.VFormatEqualsValueToString)- was failing on my machine- it passes if I add CultureInfo.CurrentUICulture to the value.ToString() - as I presume was the intended behavior * updated uppercase 'L' & BaseUnits in json - updated liter abbreviations for g/l, g/dl, g/ml & kg/l to uppercase 'L' (TODO Density?) - added base units to all units in MassConcentration & Molarity (TODO Density?) * BaseUnits, Obsolete methods & cosmetics - corrected the BaseUnits for MassConcentration - marked the invalid methods from Molarity/Density as Obsolete (were previously omitted) - some cosmetic changes to the Unit Tests * Removed Molarity.Molar as redundant (added abbreviation instead) - MolesPerLiter: fixed the BaseUnits (default) to Deimeter/Mole - Molar: removed in favor of using the alternative abbreviation 'M" - MolarityTests - OneMilliMolarFromStringParsedCorrectly skipped while awaiting fix for #344 * Added a KnownQuantities class - added a KnownQuantities class with a few constants that were used in multiple tests - replaced the usages in MassConcentrationTests MolarityTests * VolumeConcentrationTests * Testing with Theory + InlineData - converted two of the MassConcentration tests to using Theory + InlineData * Tests refactoring (Theory + InlineData) - removed BaseUnits from GramPerDeciliter(not exact + overlap), kept it in GramPerLiter (as exact & non-overlapping), also kept it for GramPerMilliliter(exact + overlapping) because I thought it would be useful to have at least one such case for future testing - moved the Mass/MolarMass operator to the Mass class (removing the MolarMass.extra) - all tests refactored using Theory + Inline Data - moved one or two tests to the appropriate .Test file - removed a few redundant tests * Make single line act-statements in tests * Updated scripts to iterate over abbreviations - Types.psm1: type of AbbreviationsWithPrefixes changed to object[] - GenerateUnits.ps1: Add-PrefixUnits now iterates over all abbreviations (incl. with prefix) - Duration: added the cyrilic equivalent to "s": "sec" ("с", "сек") to both the main and the prefixed abbrviations - DurationTests: added a Theory with some of the main test cases for parsing seconds & milliseconds - MolarityTests: removed the Skip for the awaiting test * Update scripts WRC - same fix applied to the WRC project
- Loading branch information
1 parent
5e26a16
commit fa048aa
Showing
9 changed files
with
207 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 69 additions & 1 deletion
70
UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters