Iterations

System Testing for C

The WHILE instruction comprises the keywords WHILE and END. It lets you define loops and follows these rules:

The sequence WHILE (test) and the keyword END WHILE must each appear separately on their own lines.

Example

HEADER "Instruction WHILE", "", ""

#int count = 0;

#appl_id_t id;

#message_t message;

SCENARIO One

FAMILY nominal

  CALL mbx_init(&id) @ err_ok

  VAR id.applname, INIT="JUPITER"

  CALL mbx_register(&id) @ err_ok

  VAR message, INIT={

& type=>DATA,

& applname=>"SATURN",

& userdata=>"hello world!"}

  WHILE (count<10)

     CALL mbx_send_message(&id,&message) @ err_ok

     VAR count, INIT=count+1

  END WHILE

  CALL mbx_unregister(&id) @ err_ok

  CALL mbx_end(&id) @ err_ok

END SCENARIO

Related Topics

ConditionsMultiple ConditionsWHILE