Changed how the logging works to log to a static buffer, then the hooks pull info out from there.

This commit is contained in:
Peter Goodman
2017-10-30 14:16:02 -04:00
parent e4f4cfe0db
commit 3702bfcb81
6 changed files with 86 additions and 44 deletions
+1 -1
View File
@@ -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[]) {