Tutorial 4 - Introducing test_equal

// tutorial4.ot
group "tutorial_4";

test_equal("Compare 2 integers", "%d", 37, 37); 

test_equal("Compare 2 floats", "%f", 37.5, 37.5); 

test_equal("Compare 2 strings", "%s", "Hello", "Hello");

test_equal("Fail Compare 2 integers", "%d", 32, 42); 

test_equal("Fail Compare 2 floats", "%f", 37.1, 37.9); 

test_equal("Fail Compare 2 strings", "%s", "Hello", "ello");

test_equal compares two expressions, if they are equal the test will pass, otherwise it will fail. The first parameter is the name of the test, the second is the type of expressions used.

=========================================================================
Opera Testsuite
=========================================================================

=========================================================================
E:/src/operaclean/opera-windows7/modules/selftest/documentation/tutorial/tutorial4.ot(2):  tutorial_4 
=========================================================================
  Compare 2 integers ............................................ Passed
  Compare 2 floats .............................................. Passed
  Compare 2 strings ............................................. Passed
  Fail Compare 2 integers ....................................... FAILED
E:/src/operaclean/opera-windows7/modules/selftest/documentation/tutorial/tutorial4.ot(10): 32 should be equal to 42. Values were '32' and '42'
  Fail Compare 2 floats ......................................... FAILED
E:/src/operaclean/opera-windows7/modules/selftest/documentation/tutorial/tutorial4.ot(12): 37.1 should be equal to 37.9. Values were '37.100000' and '37.900000'
  Fail Compare 2 strings ........................................ FAILED
E:/src/operaclean/opera-windows7/modules/selftest/documentation/tutorial/tutorial4.ot(14): "Hello" should be equal to "ello". Values were 'Hello' and 'ello'
=========================================================================
6 tests run, 3 tests failed, 0 tests skipped, 3 tests OK
Place a breakpoint in testsuite_break_here() to debug the failed tests
=========================================================================