!! Version 2 # Force the test runner to ensure the extension is loaded !! functionhooks af_float !! endfunctionhooks # This file tests the #af_float parser function !! test Test positive integer float !! wikitext {{#af_float: 10 }} !! html
float__^__10
!! end !! test Test positive float !! wikitext {{#af_float: 10.12 }} !! htmlfloat__^__10.12
!! end !! test Test negative integer float !! wikitext {{#af_float: -10 }} !! htmlfloat__^__-10
!! end !! test Test negative float !! wikitext {{#af_float: -10.12 }} !! htmlfloat__^__-10.12
!! end !! test Test large float !! wikitext {{#af_float: 100000000000000000000000000000000.0 }} !! htmlfloat__^__1.0E+32
!! end !! test Test large negative float !! wikitext {{#af_float: -100000000000000000000000000000000.0 }} !! htmlfloat__^__-1.0E+32
!! end !! test Test large float as E notation !! wikitext {{#af_float: 1.0E+32 }} !! htmlfloat__^__1.0E+32
!! end !! test Test large negative float as E notation !! wikitext {{#af_float: -1.0E+32 }} !! htmlfloat__^__-1.0E+32
!! end !! test Test small float !! wikitext {{#af_float: 0.00000000000000000000000000000001 }} !! htmlfloat__^__1.0E-32
!! end !! test Test small negative float !! wikitext {{#af_float: -0.00000000000000000000000000000001 }} !! htmlfloat__^__-1.0E-32
!! end !! test Test small float as E notation !! wikitext {{#af_float: 1.0E-32 }} !! htmlfloat__^__1.0E-32
!! end !! test Test small negative float as E notation !! wikitext {{#af_float: -1.0E-32 }} !! htmlfloat__^__-1.0E-32
!! end !! test Test float is idempotent !! wikitext {{#af_float: 10.0 }} {{#af_float: {{#af_float: 10.0 }} }} !! htmlfloat__^__10 float__^__10
!! end !! test Test invalid type gives error !! wikitext {{#af_float: true }} !! htmlArrayFunctions (#af_float): Could not match expected type float with actual type string for parameter 1 ("true").
!! end !! test Test too many arguments !! wikitext {{#af_float: 1.0 | yes }} !! htmlArrayFunctions (#af_float): Expected at most 1 positional parameter, 2 given.
!! end