Fixed build errors for c++ test basics. Added a ForAll thingy to abstract around making symbols. Shortened section name lengths. Added a simple arithmetic properties test case.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Trail of Bits, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <mctest/Quantified.hpp>
|
||||
|
||||
using namespace mctest;
|
||||
|
||||
__attribute__((noinline))
|
||||
int add(int x, int y) {
|
||||
return x + y;
|
||||
}
|
||||
|
||||
McTest_EntryPoint(AdditionIsCommutative) {
|
||||
ForAll<int, int>([] (int x, int y) {
|
||||
McTest_Assert(add(x, y) == add(y, x));
|
||||
});
|
||||
}
|
||||
@@ -14,3 +14,6 @@
|
||||
|
||||
add_executable(OutOfBoundsInt OutOfBoundsInt.c)
|
||||
target_link_libraries(OutOfBoundsInt mctest)
|
||||
|
||||
add_executable(ArithmeticProperties ArithmeticProperties.cpp)
|
||||
target_link_libraries(ArithmeticProperties mctest)
|
||||
|
||||
Reference in New Issue
Block a user