Random testing: Difference between revisions

Content deleted Content added
mNo edit summary
Line 15:
<syntaxhighlight lang="cpp">
int myAbs(int x) {
if (x > 0) {
return x;
}
Line 31:
int x = getRandomInput();
int result = myAbs(x);
assert(result >= 0);
}
}
Line 39:
<syntaxhighlight lang="cpp">
int getRandomInput() {
.// . .
}
 
Line 47:
long y = getRandomInput();
long result = fastMultiplication(x, y);
assert(x * y == result);
}
}