test.equal: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "{{Languages|test.equal}} {{MacroFunction |name=test.equal |trusted=true |version= |description=Compares an actual value with an expected value and prints the output to chat. |usage= <syntaxhighlight lang="mtmacro" line> test.equal(expected, actual, label) </syntaxhighlight> '''Parameters''' {{param|expected|The value to compare against.}} {{param|actual|The value to compare.}} {{param|label|An identifying string included in the output.}} |example= <syntaxhighlight lang=...")
 
(Created initial page)
Line 18: Line 18:
[r: test.equal(1, myUDF(1,2), "Test #1 ")]
[r: test.equal(1, myUDF(1,2), "Test #1 ")]
</syntaxhighlight>
</syntaxhighlight>
output:  
output: '''Test #1 Succeeded'''
'''Test #1 Succeeded'''
output: '''Test #1 Failed, expected 1 got 0'''
'''Test #1 Failed, expected 1 got 0'''


|also=
|also=

Revision as of 09:22, 31 May 2024

Languages:  English


test.equal() Function

 Note: This function can only be used in a Trusted Macro

Compares an actual value with an expected value and prints the output to chat.

Usage

test.equal(expected, actual, label)

Parameters

  • expected - The value to compare against.
  • actual - The value to compare.
  • label - An identifying string included in the output.

Example

[r: test.equal(1, myUDF(1,2), "Test #1 ")]

output: Test #1 Succeeded

output: Test #1 Failed, expected 1 got 0

See Also

Languages:  English