|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsofya.tools.th.TestHistory
public class TestHistory
A TestHistory encapsulates test history information for a traced method.
This class is modeled loosely upon the dbh_th_info struct
found in the Aristotle system, with appropriate affordances for
object-oriented design. Test history information is stored per block
in bit vectors, which are allocated on a need basis to reduce the
memory footprint. The usual methods for accessing and building test
history information for the method are provided. The
TestHistoryHandler coordinates the management
of test histories for every method in a class.
Once constructed, the number of method blocks in a test history cannot be changed. The number of tests associated with a block can grow as needed, however.
TestHistoryBuilder,
TestHistoryHandler,
TestHistoryViewer,
ProgramEventDispatcher| Constructor Summary | |
|---|---|
TestHistory(int highestBlockID,
int highestTestID)
Default constructor, creates a test history with the specified number of method blocks and an initial number of tests. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the test history for every method block. |
java.lang.Object |
clone()
Creates a deep clone of this test history object. |
boolean |
equals(java.lang.Object obj)
Tests whether this test history object is equal to another test history. |
int |
getHighestBlockID()
Gets the highest block ID present in the method. |
int |
getHighestTestID()
Gets the current highest test number. |
boolean |
isEmpty(int blockID)
Reports whether the history for a block is empty, that is, no tests traversed that block. |
boolean |
isHistoryEmpty()
Reports whether the entire test history is empty, that is, no tests traversed any blocks in the method. |
boolean |
query(int blockID,
int testID)
Queries whether a block is exercised by a given test. |
void |
set(int blockID,
int testID)
Marks that a block is exercised by a given test. |
TestHistory |
union(TestHistory th)
Creates a test history that is the union of this test history and another test history. |
void |
unset(int blockID,
int testID)
Marks that a block is not exercised by a given test. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TestHistory(int highestBlockID,
int highestTestID)
highestBlockID - Highest possible block number in the method,
cannot be changed after instantiation.highestTestID - Initial number of tests to be associated with
the test history.| Method Detail |
|---|
public int getHighestBlockID()
public int getHighestTestID()
public boolean isHistoryEmpty()
true if no tests hit any block in the method,
false otherwise.public boolean isEmpty(int blockID)
blockID - ID of the block to be checked.
true if no tests hit the specified block in the
method, false otherwise.
public void set(int blockID,
int testID)
blockID - ID of the block for which a new test is being added.testID - Number of the new test that exercised the block.
public boolean query(int blockID,
int testID)
blockID - ID of the method block to be queried.testID - Number of the test for which is it is being checked
whether it exercises the given block.
true if the test exercises the given block,
false otherwise.
public void unset(int blockID,
int testID)
blockID - ID of the block for which a test is being removed.testID - Number of the test that no longer exercises the block.public void clear()
public java.lang.Object clone()
This method is the object-oriented Java analogue to the Aristotle
dbh_th_copy procedure.
clone in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
This method first compares the number of method blocks and highest test ID in this test history to that of the specified object. If both are equal, it then performs a block-by-block comparison of the test history bit vectors. The test histories are considered equal if and only if every test history bit vector is equivalent.
This method is the object-oriented Java analogue to the Aristotle
dbh_th_equal procedure.
equals in class java.lang.Objectobj - Test history to which this test history should be
compared for equality.
true if the specified test history is equal to
this test history, false otherwise.public TestHistory union(TestHistory th)
The specified test history must have the same number of method blocks as this test history. The method will then take the logical union of every test history bit vector in the two test histories. In the event of a mismatch in the size of the bit vectors, the resultant bit vector will always be the size of the larger vector. The resulting test history will be an entirely new object, neither the current test history or the specified test history will be modified by this method.
This method is the object-oriented Java analogue to the Aristotle
dbh_th_union procedure.
th - Test history for which the union should be taken with
this test history.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||