All tests passed.

test_1_English_basic:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|0|en}} 0 0
DaY {{#invoke:Formatnum|formatNum|-123|en}} −123 −123

test_2_unnecessary_signs:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|-0|en}} 0 0
DaY {{#invoke:Formatnum|formatNum|+123|en}} 123 123

test_3_non_numbers_preserved:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|12:34:45|en}} 12:34:45 12:34:45
DaY {{#invoke:Formatnum|formatNum|12 h 34|fr}} 12 h 34 12 h 34
DaY {{#invoke:Formatnum|formatNum|12:34:45|th}} 12:34:45 12:34:45
DaY {{#invoke:Formatnum|formatNum|12:34:45.00|en}} 12:34:45.00 12:34:45.00
DaY {{#invoke:Formatnum|formatNum|12°34′45.00″|en}} 12°34′45.00″ 12°34′45.00″
DaY {{#invoke:Formatnum|formatNum|1234 locuitori|ro}} 1234 locuitori 1234 locuitori

test_5_English_bad_parameters:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|200.1|en|prec=3,5}} 200.1 200.1
DaY {{#invoke:Formatnum|formatNum|200.1|en|prec=a}} 200.1 200.1

test_6_decimal_separator:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|.12345|en}} 0.12345 0.12345
DaY {{#invoke:Formatnum|formatNum|.12345|ro}} 0,12345 0,12345
DaY {{#invoke:Formatnum|formatNum|123.45|en}} 123.45 123.45
DaY {{#invoke:Formatnum|formatNum|123.45|ro}} 123,45 123,45
DaY {{#invoke:Formatnum|formatNum|123.|en}} 123 123
DaY {{#invoke:Formatnum|formatNum|123.|ro}} 123 123
DaY {{#invoke:Formatnum|formatNum|123.00|en}} 123 123
DaY {{#invoke:Formatnum|formatNum|123.00|ro}} 123 123

test_7_no_grouping_separators:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|100000|en|sep=1}} 100000 100000
DaY {{#invoke:Formatnum|formatNum|100000|fr|sep=1}} 100000 100000

test_8_HTML_entity_or_native_UTF8:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|12345|en}} 12,345 12,345
DaY {{#invoke:Formatnum|formatNum|12345|ro}} 12.345 12.345
DaY {{#invoke:Formatnum|formatNum|12345|fr}} 12 345 12 345

test_9_large_numbers:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|234,907,967,154,120}} 2,3490796715412 × 1014 2,3490796715412 × 1014
DaY {{#invoke:Formatnum|formatNum|{{#expr:1/234907967154122528}}}} 4,2569863087866 × 10-18 4,2569863087866 × 10-18

test_Unsupported_languages_using_user_default_language_instead_may_fail:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|100000||sep=1}} 100000 100000
DaY {{#invoke:Formatnum|formatNum|100000|aa|sep=1}} 100000 100000
DaY {{#invoke:Formatnum|formatNum|100000|qq|sep=1}} 100000 100000
DaY {{#invoke:Formatnum|formatNum|100000|qqa|sep=1}} 100000 100000
DaY {{#invoke:Formatnum|formatNum|100000|mul|sep=1}} 100000 100000
DaY {{#invoke:Formatnum|formatNum|100000|und|sep=1}} 100000 100000
DaY {{#invoke:Formatnum|formatNum|100000|root|sep=1}} 100000 100000
DaY {{#invoke:Formatnum|formatNum|100000|user|sep=1}} 100000 100000
DaY {{#invoke:Formatnum|formatNum|100000|invalid|sep=1}} 100000 100000

test_forceStripSeparators:

Text Așteptat Rezultat
DaY One comma, thousands 1.234 1.234
DaY One comma, decimal 123456.789 123456.789
DaY One comma, confusing 123.456 123.456
DaY One dot, thousands 1.234 1.234
DaY One dot, decimal 123456.789 123456.789
DaY One dot, confusing 123.456 123.456

test_invokeStripSeparators:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|stripSeparators|123456789}} 123456789 123456789
DaY {{#invoke:Formatnum|stripSeparators|123456,789}} 123456.789 123456.789
DaY {{#invoke:Formatnum|stripSeparators|123,456,789}} 123456789 123456789
DaY {{#invoke:Formatnum|stripSeparators|123456.789}} 123456.789 123456.789
DaY {{#invoke:Formatnum|stripSeparators|123,456.789}} 123456.789 123456.789
DaY {{#invoke:Formatnum|stripSeparators|123.456,789}} 123456.789 123456.789
DaY {{#invoke:Formatnum|stripSeparators|123,456,789.012}} 123456789.012 123456789.012
DaY {{#invoke:Formatnum|stripSeparators|123.456.789}} 123456789 123456789
DaY {{#invoke:Formatnum|stripSeparators|123.456.789,012}} 123456789.012 123456789.012
DaY {{#invoke:Formatnum|stripSeparators|123.456.789,012,345}}

test_stripSeparators:

Text Așteptat Rezultat
DaY No separator 123456789 123456789
DaY One comma 123456.789 123456.789
DaY Comma only 123456789 123456789
DaY One dot 123456.789 123456.789
DaY One dot, one comma English 123456.789 123456.789
DaY One dot, one comma Romanian 123456.789 123456.789
DaY One dot, 2 commas 123456789.012 123456789.012
DaY Dot only 123456789 123456789
DaY 2 dots, 1 comma 123456789.012 123456789.012
DaY 2 dots, 2 commas nil nil

test_underflow:

Text Așteptat Rezultat
DaY {{#invoke:Formatnum|formatNum|0.0000001|ro}} 1 × 10-7 1 × 10-7
DaY {{#invoke:Formatnum|formatNum|0.000001|ro}} 1 × 10-6 1 × 10-6
DaY {{#invoke:Formatnum|formatNum|0.00001|ro}} 1 × 10-5 1 × 10-5
DaY {{#invoke:Formatnum|formatNum|0.0001|ro}} 0,0001 0,0001
DaY {{#invoke:Formatnum|formatNum|0.001|ro}} 0,001 0,001
DaY {{#invoke:Formatnum|formatNum|0.01|ro}} 0,01 0,01


Începeți o discuție despre Modul:Formatnum/testcases

Începeți o discuție
Înapoi la pagina „Formatnum/testcases”.