Skip to content

Commit

Permalink
Avoid division by or modulo of zero in test scenario's maths test (bu…
Browse files Browse the repository at this point in the history
…g #25214)
  • Loading branch information
Wedge009 committed Oct 22, 2016
1 parent 15afec7 commit 50146bc
Showing 1 changed file with 58 additions and 18 deletions.
76 changes: 58 additions & 18 deletions data/scenario-test.cfg
Expand Up @@ -2635,15 +2635,35 @@ For game purposes, the races group into factions; for example, orcs often cooper
variable=divisor
[/text_input]
[/message]
{VARIABLE total $number}
[set_variable]
name=total
divide=$divisor
[/set_variable]
[message]
speaker=narrator
message="Dividing $number| by $divisor| results in $total|."
[/message]
[if]
[variable]
name=divisor
equals=0
[/variable]
[or]
[variable]
name=divisor
equals=
[/variable]
[/or]
[then]
[message]
speaker=narrator
message="Cannot divide by zero!"
[/message]
[/then]
[else]
{VARIABLE total $number}
[set_variable]
name=total
divide=$divisor
[/set_variable]
[message]
speaker=narrator
message="Dividing $number| by $divisor| results in $total|."
[/message]
[/else]
[/if]
[/command]
[/option]
[option]
Expand All @@ -2656,15 +2676,35 @@ For game purposes, the races group into factions; for example, orcs often cooper
variable=modulo
[/text_input]
[/message]
{VARIABLE total $number}
[set_variable]
name=total
modulo=$modulo
[/set_variable]
[message]
speaker=narrator
message="$number| % $modulo| = $total|."
[/message]
[if]
[variable]
name=modulo
equals=0
[/variable]
[or]
[variable]
name=modulo
equals=
[/variable]
[/or]
[then]
[message]
speaker=narrator
message="Cannot use modulus of zero!"
[/message]
[/then]
[else]
{VARIABLE total $number}
[set_variable]
name=total
modulo=$modulo
[/set_variable]
[message]
speaker=narrator
message="$number| % $modulo| = $total|."
[/message]
[/else]
[/if]
[/command]
[/option]
[option]
Expand Down

0 comments on commit 50146bc

Please sign in to comment.