Skip to content

Commit

Permalink
add support for numbers in scientific notation
Browse files Browse the repository at this point in the history
  • Loading branch information
gvolpe committed Oct 15, 2021
1 parent 3d67a84 commit 7aea3b5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions data/scientific-notation.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[com/github/wwmm/easyeffects/streamoutputs/bassenhancer]
amount=-6.9388939039072284e-16
blend=0.0
listen=true
15 changes: 15 additions & 0 deletions output/scientific-notation.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{ lib, ... }:

with lib.hm.gvariant;

{
dconf.settings = {
"com/github/wwmm/easyeffects/streamoutputs/bassenhancer" = {
amount = -6.938893903907228e-16;
blend = 0.0;
listen = true;
};

};
}
2 changes: 1 addition & 1 deletion src/DConf.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ vDouble = try $ do
s <- option "" $ string "-"
n <- many1 digit
d <- string "."
e <- many1 digit
e <- many1 (digit <|> oneOf "eEdD-")
pure . D $ read (s <> n <> d <> e)

vInt :: Parsec Text () Value
Expand Down
10 changes: 10 additions & 0 deletions test/DConf2NixTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,15 @@ dconf2nixKeybindings =
prop_dconf2nix_keybindings :: Property
prop_dconf2nix_keybindings = withTests (10 :: TestLimit) dconf2nixKeybindings

dconf2nixScientificNotation :: Property
dconf2nixScientificNotation =
let input = "data/scientific-notation.settings"
output = "output/scientific-notation.nix"
root = Root T.empty
in baseProperty input output root

prop_dconf2nix_scientific_notation :: Property
prop_dconf2nix_scientific_notation = withTests (10 :: TestLimit) dconf2nixScientificNotation

dconf2nixTests :: Group
dconf2nixTests = $$(discover)

0 comments on commit 7aea3b5

Please sign in to comment.