Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Print expected values as well

So the problem is that the test runner has to compute the expected results every time she runs the test script.

A slight improvement will be to show the expected results next to the actual values.

<?php

require_once(dirname(__FILE__) . '/../includes/mylib.php');

print add(1,1)   . ' == 2<br>';
print add(2,2)   . ' == 4<br>';
print add(1,1,1) . ' == 3<br>';

?>

Result:

2 == 2
4 == 4
2 == 3

This is still hard to follow when there are lots of cases or even a few cases with large output but it seems to be a step in the good direction.