Test a function: Difference between revisions

No edit summary
Line 1,624:
=={{header|SQL PL}}==
{{works with|Db2 LUW}}
{{libheader|db2unit}}
<lang sql>
CREATE OR REPLACE PROCEDURE TEST_MY_TEST()
BEGIN
DECLARE EXPECTED INTEGER;
DECLARE ACTUAL INTEGER;
CALL DB2UNIT.REGISTER_MESSAGE('My first test');
SET EXPECTED = 2;
SET ACTUAL = 1+1;
CALL DB2UNIT.ASSERT_INT_EQUALS('Same value', EXPECTED, ACTUAL);
END @
</lang>
 
<pre>
db2 => CALL DB2UNIT.RUN_SUITE('DB2UNIT_EXAMPLE');
 
 
Result set 1
--------------
 
TEST FINAL_STATE MICROSECONDS MESSAGE
---------------- ----------- ------------ ----------------------------------------------------------------
Before Suite - - Starting execution
TEST_MY_TEST Passed 29585 Executing TEST_MY_TEST
After Suite - - Finishing execution
- - 1 tests were executed
- - 1 tests passed
- - 0 tests failed
- - 0 tests with errors
 
7 record(s) selected.
 
 
Result set 2
--------------
 
TIME EXECUTION_ID STATUS MESSAGE
-------- ------------ --------------------- --------------------------------------------------------------
20:43:47 52613 Initialization db2unit is licensed under the terms of the GPL v3
20:43:47 52613 Initialization Execution of ANGOCA with ID 52613
20:43:47 52613 Prepare Report The reports table created: ANGOCA.REPORT_TESTS
20:43:48 52613 Calculating time Total execution time is: 0 seconds
 
4 record(s) selected.
 
Return Status = 0
</pre>
 
=={{header|Swift}}==
Anonymous user