Test-If

From FSDeveloper Wiki
Revision as of 09:13, 1 June 2009 by BASys (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Hi Folks

Could we please install the ParserFunctions MediaWiki extension ? See - http://meta.wikimedia.org/wiki/ParserFunctions

Many thanks ATB Paul

Ignore the rest of this page as it won't work without ParserFunctions


Some results from parser function parameters:

If Tests

If tests look to be working ok.

ifeq

{{#ifeq:{{lc:AbC}}|abc|yes}}  should evaluate to 'yes' 

Result = yes

{{#ifeq:banana|abc|true|false}}  should evaluate to 'false' 

Result = false

{{#ifeq:yellow|yellow|true|false}}  should evaluate to 'true' 

Result = true


ifexpr

{{#ifexpr: 10 > 9 | yes | no}}  should evaluate to 'yes' 

Result = yes.

{{#ifexpr: 9 > 10 | yes | no}}  should evaluate to 'no' 

Result = no.

Operator Operation Example Result
none {{ #expr123456789012345 }} 1.2345678901234E+14
{{ #expr0.000001 }} 1.0E-6
Arithmetic
+ Unary positive sign {{ #expr+30 * +7 }} 210
- Unary negative sign {{ #expr-30 * -7 }} 210
* Multiplication {{ #expr30 * 7 }} 210
/
div
Division {{ #expr30 / 7 }}
{{ #expr30 div 7 }}
4.2857142857143
4.2857142857143
+ Addition {{ #expr30 + 7 }} 37
- Subtraction {{ #expr30 - 7 }} 23
Logic
not Unary NOT
logical NOT
{{ #exprnot 0 * 7 }}
{{ #exprnot 30 + 7 }}
7
7
and Logical AND

{{ #expr4 < 5 and 4 mod 2 }}

0
or Logical OR

{{ #expr4 < 5 or 4 mod 2 }}

1
Comparison
= Equality (numerical & logical) {{ #expr30 = 7 }} 0
<>
!=
Inequality, logical exclusive or {{ #expr30 <> 7 }}
{{ #expr1 != 0 }}
1
1
< Less than

{{ #expr30 < 7 }}

0
> Greater than

{{ #expr30 > 7 }}

1
<= Less than or equal to

{{ #expr30 <= 7 }}

0
>= Greater than or equal to

{{ #expr30 >= 7 }}

1
Other
( ) Grouping operators {{ #expr(30 + 7) * 7  }} 259
mod "Modulo" truncates the numbers to whole numbers, divides the left number by the right, and returns the remainder that could not be divided.
Note: div and mod are different from all programming languages.
{{ #expr30 mod 7 }}
{{ #expr-8 mod -3 }}
{{ #expr8 mod 2.7 }}
2
-2
0
round Rounds off the number on the left to the power of 1/10 given on the right. {{ #expr30 / 7 round 4 }}
{{ #expr30 / 7 round 1 }}
{{ #expr1911 round -2 }}
{{ #expr-2.5 round 0 }}
4.2857
4.3
1900
-3


To Investigate

May require other template(s). Though AFAIK I don't need these.  ;-)

{{#len:string}} for string = 123456789 should evaluate to '9' 

Result = {{#len:123456789}}

{{#pos:string|target|offset}}  should evaluate to '10' 

Result = {{#pos:blah blah target in string|target|offset}}

Table Row Test

I'll need to remove my workaround attempts.

Prefix Data not passed

Suffix Data not passed