Testing Agent Behavior
243
(a) Correct model.
(b) With wrong conditions added to
code.
FIGURE 8.3: Plots of no-hope cells with correct and incorrect codes.
8.3 Statistics Testing on Code
The DAIKON inference tool is also found to be useful in finding code
anomalies. The example from [106] shows the following code and invariants
produced:
Code:
int ABS(int x)
{
if (x>0) return x;
else return (x*(-1));
}
int main ()
{
int i=0;
int abs_i;
for (i=-5000;i<5000;i++)
{
abs_i=ABS(i);
}
}
Expected invariants:
Return value of ABS(x) ==
(x>0) ? x: -x;
Daikon Output:
Précédent

- 272/329

Suivant