Write the rule first
Raise an alarm only above 30.0. This sentence decides what happens at exactly 30.0. Implement the production rule in a function so the test calls precisely the same calculation that a larger program would use.
Choose three cases
Select a value below the limit, exactly at the limit, and above it. For each input, compare the returned boolean with the expected boolean. A correct run prints true three times. If one line prints false, its position identifies the case to inspect.
Prove a test can fail
Temporarily replace > with >= and run again. The below and above cases still pass. The equality case now prints false. Restore the strict comparison and repeat. This gives you evidence that at least one test can detect a real defect.
Compare execution paths
Run the same source with blyxc run, then build an executable and compare its output on the same inputs. Checking the process exit status detects execution failures. Checking actual output against expected output detects wrong answers from executions that finished successfully.
Try the program
Expected output
true true true
Practice
Change the rule to include exactly 30 and update the expected result for that input.
Hint
The implementation and the test expectation express two sides of the same contract.
Worked solution
Both changes are needed to keep all three tests passing under the new specification.
Find
t > 30.0Replace with
t >= 30.0Find
alarm(30.0) == falseReplace with
alarm(30.0) == trueOutput after the change
true true true