It checks reset, three increments, then value retention with i_enable disabled. Failures report the time, expected value, and actual value.
Understand nonblocking assignment timing
At a rising edge, the counter block evaluates the right-hand side of <=. The update is scheduled in the NBA region of that same simulation time step.
A testbench reading the output in the active region at that edge may still see the old value. Checking at the falling edge allows the update to complete. Blocking stimulus assignments and nonblocking DUT assignments alone do not remove every race; sampling time still matters.
=== and !== compare all four logic states. With a known expected value, !== also catches unexpected X or Z bits. == may return an unknown result and undermine a poorly written check.
Wait for the intended event
@(posedge clk) waits for the next rising edge.
repeat (N) @(posedge clk) counts N edges.
wait(condition) continues immediately if the condition is already true; otherwise it waits for it to become true.
#delay waits using the unit selected by timescale.
For a valid/ready interface, check transfers accepted at the protocol's sampling edge. Waiting for valid alone does not establish correct latency or stall behavior.
Make results useful
Include wraparound, simultaneous commands, held inputs, and reset during activity. For memories and FIFOs, cover full and empty states too. A timeout prevents a stalled exchange from running forever.
Waveforms help explain a failure; automated comparisons should determine whether the behavior is correct.