# * number parsing

# ** 1. Simple case
<
2017/1/1
	a   1,000.00 EUR
	b  -1,000.00 EUR
$ hledger bal -f - --no-total
        1,000.00 EUR  a
       -1,000.00 EUR  b

# ** 2. No digits before decimal sep
<
2017/1/1
	a   .01 EUR
	b
$ hledger bal -f - --no-total
            0.01 EUR  a
           -0.01 EUR  b

# ** 3. No digits after decimal sep
<
2017/1/1
	a   1. EUR
	b
$ hledger bal -f - --no-total
               1 EUR  a
              -1 EUR  b

# ** 4. No digits at all
<
2017/1/1
	a   . EUR
	b
$ hledger bal -f -
>2 //
>= 1

# ** 5. Spaces between digit groups, any of the 8 unicode space characters we support.
<
2000-01-01
  (a)  1 000. A  ; space                    
  (b)  1 000. B  ; no-break space           
  (c)  1 000. C  ; en space                 
  (d)  1 000. D  ; em space                 
  (e)  1 000. E  ; punctuation space        
  (f)  1 000. F  ; thin space               
  (g)  1 000. G  ; narrow no-break space    
  (h)  1 000. H  ; medium mathematical space

$ hledger bal -f - -N
             1 000 A  a
             1 000 B  b
             1 000 C  c
             1 000 D  d
             1 000 E  e
             1 000 F  f
             1 000 G  g
             1 000 H  h

# ** 6. Space between digits groups in commodity directive
<
commodity 1 000.00 EUR

2017/1/1
	a   1,000.00 EUR
	b  -1,000.00 EUR
$ hledger bal -f - --no-total
        1 000.00 EUR  a
       -1 000.00 EUR  b

# ** 7. Default commodity
<
D 1,000.00 EUR

2017/1/1
	a   1,000
	b  -1,000 EUR
$ hledger bal -f -
        1,000.00 EUR  a
       -1,000.00 EUR  b
--------------------
                   0  

# ** 8. Omitted decimals
<
2017/1/1
	a   1,000 EUR
	b  -1,000.00 EUR
$ hledger bal -f -
>2 //
>= 1

# ** 9. Omitted decimals with commodity hint
<
commodity 1,000.00 EUR

2017/1/1
	a   1,000 EUR
	b  -1,000.00 EUR
$ hledger bal -f -
        1,000.00 EUR  a
       -1,000.00 EUR  b
--------------------
                   0  

# ** 10. Omitted decimals with commodity hint and symbol on left
<
commodity €1,000.00

2017/1/1
	a   €1,000
	b  €-1,000.00
$ hledger bal -f -
           €1,000.00  a
          €-1,000.00  b
--------------------
                   0  

# ** 11. Commodity directive requires a decimal separator
<
commodity 1000 EUR
$ hledger bal -f -
> //
>2 /Please include a decimal point or decimal comma/
>= 1

# ** 12. Commodity directive with zero precision
<
commodity 100. EUR

2017/1/1
	a   1,000 EUR
	b  -1,000.00 EUR
$ hledger bal -f -
            1000 EUR  a
           -1000 EUR  b
--------------------
                   0  

# ** 13. Big prices
<
2017/1/1
	a   -1 BTC @ 24,840 UAH
	b   24,840.00 UAH
$ hledger bal -f -  --no-total
>2 //
>= 1

# ** 14. Big prices with commodity hint
<
commodity ₴1,000.00

2017/1/1
	a   -1 BTC @ ₴24,840
	b   ₴24,840.00
$ hledger bal -f -  --no-total
              -1 BTC  a
          ₴24,840.00  b

# ** 15. adjacent punctuation chars
<
2017/1/1
	a   1,,0,,0.0 EUR
	b  -1..0..0,0 EUR
$ hledger bal -f -
>2 //
>= 1

# ** 16. adjacent punctuation chars of different types
<
2017/1/1
	a   1,0,.0 EUR
	b  -1.0.,0 EUR
$ hledger bal -f -
>2 //
>= 1

# ** 17. separator chars vary
<
2017/1/1
	a   1.0,0.0,0 EUR
	b  -1,0.0,0.0 EUR
$ hledger bal -f -
>2 //
>= 1

# ** 18. number begins with a decimal char
<
2017/1/1
	a   .1 EUR
	b  -.1 EUR
$ hledger bal -f -
             0.1 EUR  a
            -0.1 EUR  b
--------------------
                   0  

# ** 19. number begins with a separator char
<
2017/1/1
	a   ,100.0 EUR
	b  -,100.0 EUR
$ hledger bal -f -
>2 //
>= 1

# ** 20. long numbers in multi balance reports
<
2021-01-01
    (a)      -0.12345678901234567890123456 EUR
$ hledger bal -YN -f -
Balance changes in 2021:

   ||                              2021 
===++===================================
 a || -0.12345678901234567890123456 EUR 

# ** 21. When spaces are used inconsistently, what happens ? The usual, first one seen sets commodity style.
<
2000-01-01
  (a)  1 000. A  ; no-break space           
  (a)  1 000. A  ; space                    
  (a)  1 000. A  ; en space                 

$ hledger bal -f - -N
             3 000 A  a

# ** 22. And a commodity directive can enforce consistency as usual.
<
commodity 1 000. A  ; narrow no-break space

2000-01-01
  (a)  1 000. A  ; space                    
  (a)  1 000. A  ; no-break space           
  (a)  1 000. A  ; en space                 

$ hledger bal -f - -N
             3 000 A  a
