Changed how the logging works to log to a static buffer, then the hooks pull info out from there.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
add_executable(OutOfBoundsInt OutOfBoundsInt.c)
|
||||
add_executable(OutOfBoundsInt OutOfBoundsInt.cpp)
|
||||
target_link_libraries(OutOfBoundsInt mctest)
|
||||
|
||||
add_executable(ArithmeticProperties ArithmeticProperties.cpp)
|
||||
|
||||
@@ -14,18 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <mctest/McTest.h>
|
||||
#include <mctest/McUnit.hpp>
|
||||
|
||||
McTest_EntryPoint(YIsAlwaysPositive) {
|
||||
TEST(BoundsCheck, YIsAlwaysPositive) {
|
||||
int x = McTest_IntInRange(-10, 10);
|
||||
int y = x * x;
|
||||
McTest_Assert(y >= 0);
|
||||
ASSERT_GE(y, 0)
|
||||
<< "Found y=" << y << " was not always positive.";
|
||||
}
|
||||
|
||||
McTest_EntryPoint(YIsAlwaysPositive_CanFail) {
|
||||
int x = McTest_IntInRange(-10, 10);
|
||||
int y = x * x * x;
|
||||
McTest_Assert(y >= 0); /* This can fail */
|
||||
TEST(BoundsCheck, YIsAlwaysPositive_CanFail) {
|
||||
int x = McTest_Int();
|
||||
int y = x * x; // Can overflow!
|
||||
ASSERT_GE(y, 0)
|
||||
<< "Found y=" << y << " was not always positive.";
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
Reference in New Issue
Block a user