Share to:

Moduldiskussion:Formattal/testcases

Tests

All tests passed.

test_fejlangivelseskode:

Text Expected Actual
Ja Fejltekst ikke tom, skal vise stjerne * *
Ja Fejltekst tom, skal vise stjerne * *
Ja Fejltekst ikke tom, skal ikke vise stjerne

test_formattal:

Text Expected Actual
Ja {{#invoke:Formattal|formattal|1}} 1 1
Ja {{#invoke:Formattal|formattal|12}} 12 12
Ja {{#invoke:Formattal|formattal|123}} 123 123
Ja {{#invoke:Formattal|formattal|1.234}} 1.234 1.234
Ja {{#invoke:Formattal|formattal|12.345}} 12.345 12.345
Ja {{#invoke:Formattal|formattal|123.456}} 123.456 123.456
Ja {{#invoke:Formattal|formattal|1,0}} 1,0 1,0
Ja {{#invoke:Formattal|formattal|12,0}} 12,0 12,0
Ja {{#invoke:Formattal|formattal|123,0}} 123,0 123,0
Ja {{#invoke:Formattal|formattal|1.234,0}} 1.234,0 1.234,0
Ja {{#invoke:Formattal|formattal|12.345,0}} 12.345,0 12.345,0
Ja {{#invoke:Formattal|formattal|123.456,0}} 123.456,0 123.456,0
Ja {{#invoke:Formattal|formattal|1.0}} 1,0 1,0
Ja {{#invoke:Formattal|formattal|12.0}} 12,0 12,0
Ja {{#invoke:Formattal|formattal|123.0}} 123,0 123,0
Ja {{#invoke:Formattal|formattal|1,234.0}} 1.234,0 1.234,0
Ja {{#invoke:Formattal|formattal|12,345.0}} 12.345,0 12.345,0
Ja {{#invoke:Formattal|formattal|123,456.0}} 123.456,0 123.456,0
Ja {{#invoke:Formattal|formattal|1.00}} 1,00 1,00
Ja {{#invoke:Formattal|formattal|12.00}} 12,00 12,00
Ja {{#invoke:Formattal|formattal|123.00}} 123,00 123,00
Ja {{#invoke:Formattal|formattal|1.234,00}} 1.234,00 1.234,00
Ja {{#invoke:Formattal|formattal|12.345,00}} 12.345,00 12.345,00
Ja {{#invoke:Formattal|formattal|123.456,00}} 123.456,00 123.456,00
Ja {{#invoke:Formattal|formattal|1.00}} 1,00 1,00
Ja {{#invoke:Formattal|formattal|12.00}} 12,00 12,00
Ja {{#invoke:Formattal|formattal|123.00}} 123,00 123,00
Ja {{#invoke:Formattal|formattal|1,234.00}} 1.234,00 1.234,00
Ja {{#invoke:Formattal|formattal|12,345.00}} 12.345,00 12.345,00
Ja {{#invoke:Formattal|formattal|123,456.00}} 123.456,00 123.456,00
Ja {{#invoke:Formattal|formattal|-123}} -123 -123
Ja {{#invoke:Formattal|formattal|+123.00}} +123,00 +123,00
Ja {{#invoke:Formattal|formattal|+ 123.00}} +123,00 +123,00
Ja {{#invoke:Formattal|formattal|- 123.00}} -123,00 -123,00
Ja {{#invoke:Formattal|formattal|- 123.00}} -123,00 -123,00
Ja {{#invoke:Formattal|formattal|+ 123.00}} +123,00 +123,00
Ja {{#invoke:Formattal|formattal|+123.43[ref]hello[/ref] lalalala}} +123,43[ref]hello[/ref] lalalala +123,43[ref]hello[/ref] lalalala
Ja {{#invoke:Formattal|formattal|}}
Ja {{#invoke:Formattal|formattal|nonsens}} nonsens nonsens
Ja {{#invoke:Formattal|formattal|1.234.00}} 1.234.00 1.234.00
Ja {{#invoke:Formattal|formattal|12.345.00}} 12.345.00 12.345.00
Ja {{#invoke:Formattal|formattal|123.456.00}} 123.456.00 123.456.00
Ja {{#invoke:Formattal|formattal|1,234,00}} 1,234,00 1,234,00
Ja {{#invoke:Formattal|formattal|12,345,00}} 12,345,00 12,345,00
Ja {{#invoke:Formattal|formattal|123,456,00}} 123,456,00 123,456,00
Ja {{#invoke:Formattal|formattal|.123}} .123 .123
Ja {{#invoke:Formattal|formattal|.1234}} .1234 .1234
Ja {{#invoke:Formattal|formattal|0.1234}} 0.1234 0.1234
Ja {{#invoke:Formattal|formattal|,123}} ,123 ,123
Ja {{#invoke:Formattal|formattal|0,1234}} 0,1234 0,1234

test_isSequenceOfAtLeastOneDigit:

Text Expected Actual
Ja false false
Ja 1 true true
Ja a false false
Ja 12 true true
Ja 123456777 true true
Ja 123456777a false false

test_modsatAdskillertegn:

Text Expected Actual
Ja , . .
Ja . , ,

test_opdelInputITalOgRest:

Text Expected Actual
Ja -123.332.332 {"-123.332.332",""} {"-123.332.332",""}
Ja -123.332.332! {"-123.332.332","!"} {"-123.332.332","!"}
Ja ! {"","!"} {"","!"}
Ja +123,43.544[1] {"+123,43.544","[2]"} {"+123,43.544","[3]"}

test_opsplitIFortegnOgRest:

Text Expected Actual
Ja {"",""} {"",""}
Ja 1 {"","1"} {"","1"}
Ja -1 {"-","1"} {"-","1"}
Ja -12.34 {"-","12.34"} {"-","12.34"}
Ja +12,304.34 {"+","12,304.34"} {"+","12,304.34"}
Ja 12,304.34 {"","12,304.34"} {"","12,304.34"}

test_removeAll:

Text Expected Actual
Ja Remove all , from 123,332,332 123332332 123332332
Ja Remove all %. from 123,332,332 123,332,332 123,332,332
Ja Remove all %. from 123.332.332 123332332 123332332
Ja Remove all l from hello heo heo


Referencer fra tests

  1. ^ hello
  2. ^ hello
  3. ^ hello

6 nye tests fejler, hvilket viser fejl i koden

Jeg tilføjede lige 6 nye tests, og de viser, at der er fejl i koden. Medmindre altså at koden kræver, at input altid er gyldigt, men det modbeviser koden jo selv, da den i visse tilfælde melder fejl.

Jeg vil prøve at se på at rette det en af de kommende dage. De nye fejlende tests har jo ikke gjort, at den eksisterende funktionalitet er ændret, så det betyder blot, at den originale kode ikke dækkede alle fejlsituationer. Bemærk at den p.t. uden at melde fejl laver direkte forkerte oversættelser, fx .1234 → 1.234. Det bør den ikke kunne gøre. --Jhertel (diskussion) 25. okt 2017, 15:40 (CEST)

Jeg har nu slået de pågældende 6 tests til, så det er synligt, at de fejler. Fejlene er ikke løst. --Jhertel (diskussion) 21. nov 2017, 18:22 (CET)
Det er nu nede på 5 fejlende tests. Jeg er ikke begyndt på at løse fejlene endnu; jeg har i første omgang fokuseret på refaktorisering for at gøre koden mere overskuelig og forståelig. Jeg har dog forbedret en smule, når jeg så noget ikke gav mening (ingen grund til at arbejde hårdt på ligefrem at bevare fejlene under refaktoriseringen). --Jhertel (diskussion) 26. nov 2017, 15:16 (CET)
Nu er der ikke længere nogen fejlende tests – modulet består alle tests. --Jhertel (diskussion) 30. nov 2017, 04:15 (CET)

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.
Prefix: a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9

Portal di Ensiklopedia Dunia

Kembali kehalaman sebelumnya