100% found this document useful (4 votes)
4K views12 pages

State, State Graphs and Transition Testing - Transition Bugs

This document outlines the process of deducing a state graph and state table from a set of specifications for a program that tracks errors. It begins with an initial rule that the program will maintain an error counter that is incremented each time there is an error. Additional rules are then applied to expand the state graph and table, including rewriting the block on an error, erasing tape after 3 successive errors, putting the unit out of service after 3 erasures and an error, and returning to the normal state or decrementing the error counter if the rewrite or erasure was successful. However, the last rule introduces a contradiction, as it specifies decrementing the error counter after a successful rewrite regardless of erasures, which could lead to

Uploaded by

Sunit Prasad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
4K views12 pages

State, State Graphs and Transition Testing - Transition Bugs

This document outlines the process of deducing a state graph and state table from a set of specifications for a program that tracks errors. It begins with an initial rule that the program will maintain an error counter that is incremented each time there is an error. Additional rules are then applied to expand the state graph and table, including rewriting the block on an error, erasing tape after 3 successive errors, putting the unit out of service after 3 erasures and an error, and returning to the normal state or decrementing the error counter if the rewrite or erasure was successful. However, the last rule introduces a contradiction, as it specifies decrementing the error counter after a successful rewrite regardless of erasures, which could lead to

Uploaded by

Sunit Prasad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

State, State Graphs and

Transition Testing

TRANSITION BUGS Page 380 of the Boris Beizer text

Note: Please use a slide show since transitions have been


animated.
Tip: dark red text corresponds to dark red entries in the
table for that slide and so on . . .
Introduction to transition bugs…

• Exactly one transition must be specified for


every combination of input & state
• A program should not have contradictions or
ambiguities
• One of the most common source of
contradictions/ambiguities are specifications
Example to convert specification
into a state graph…
----------------------------------------------------------------
• With an example, we will now follow a set of
rules, i.e. specifications to deduce the state
graph and state tables

RULE 1:
The program will maintain an error counter
which will be incremented whenever there is
an error.
Initial state graph deduced from
Rule1…

0 error 1 error 2 error 3 error 4 ...

Okay

RULE 1: The program will maintain an error counter,


which will be incremented whenever there is an
error.
State table from the state graph(refer
earlier slide for the graph)…
INPUT

STATE OKAY ERROR


0 0/None 1/
1 2/
2 3/
3 4/
4 5/
5 6/
6 7/
7 8/
Rule 2: If there is an error, rewrite
the block INPUT

STATE OKAY ERROR


0 0/None 1/REWRITE
1 2/REWRITE
2 entries, we include a ‘Rewrite’
For all ‘Error’ 3/REWRITE
3 4/REWRITE
4 5/REWRITE
5 6/REWRITE
6 7/REWRITE
7 8/REWRITE
Rule 3: If there have been 3 successive errors,
erase 10cm of tape and then rewrite the block
INPUT

STATE OKAY ERROR


0 0/None 1/REWRITE
1 The first 3rd successive error occurs 2/REWRITE
2 3/REWRITE,ERASE,REWRITE
3 4/REWRITE,ERASE,REWRITE
4 5/REWRITE,ERASE,REWRITE
5 6/REWRITE,ERASE,REWRITE
6 7/REWRITE,ERASE,REWRITE
7 8/REWRITE,ERASE,REWRITE
Rule 4: If there have been 3 successive erasures, and
another error occurs, put the unit out of service
INPUT

STATE OKAY ERROR


0 0/None 1/REWRITE
1 2/REWRITE
2 3/REWRITE,ERASE,REWRITE
3 4/REWRITE,ERASE,REWRITE
4 5/REWRITE,ERASE,REWRITE
We have 3 successive erasures- so
5 we now put the unit out of service 6/OUT
6
7
Rule 5: If the erasure was successful, return to the
normal state and clear the error counter
INPUT

STATE OKAY ERROR


0 0/None 1/REWRITE
We reach State 3 after the 1st
1
erasure. If successful, we return to 2/REWRITE
‘None’ & the error counter is made 0
2 3/REWRITE,ERASE,REWRITE
3 0/None 4/REWRITE,ERASE,REWRITE
4 0/None 5/REWRITE,ERASE,REWRITE
5 0/None 6/OUT
6
7
Rule 6: If the rewrite was successful, decrement the
error counter and return to the previous state
INPUT

STATE OKAY ERROR


0 0/None 1/REWRITE
1 0/None 2/REWRITE
2 1/None 3/REWRITE,ERASE,REWRITE
3 0/None 4/REWRITE,ERASE,REWRITE
2/None
4 0/None 5/REWRITE,ERASE,REWRITE
3/None
5 0/None 6/OUT
4/None Example: Say we are at state 1. The error
counter here is 2. If we have a successful(okay)
6 rewrite, the entry for okay at state 2 will have
error counter decremented by 1 which is:
7
(2-1)/None where, None  output for success.
Conclusion…
• Observe the previous slide-
RULE6 states “If the rewrite was successful, then decrement
the error counter and return to the previous state”.
The requirement probably was – “If there have been no
erasures and rewrite was successful, then …”
• This has now resulted in contradictions – which is a concern
as it might lead to bugs.
• It is always unlikely that a contradictory specification can
result in a satisfactory implementation.
Done!!! Please feel free to get back
incase you have any questions 

You might also like