mirror of
https://github.com/boostorg/contract.git
synced 2026-02-27 17:02:15 +00:00
finished example section. recompiled all tests and examples.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
|
||||
//[n1962_sum
|
||||
#include <boost/contract.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <cassert>
|
||||
|
||||
int sum(int count, int* array) {
|
||||
int result;
|
||||
auto c = boost::contract::function()
|
||||
boost::contract::guard c = boost::contract::function()
|
||||
.precondition([&] {
|
||||
BOOST_CONTRACT_ASSERT(count % 4 == 0);
|
||||
})
|
||||
@@ -18,8 +18,8 @@ int sum(int count, int* array) {
|
||||
|
||||
int main() {
|
||||
int a[4] = {1, 2, 3, 4};
|
||||
BOOST_TEST_EQ(sum(4, a), 10);
|
||||
return boost::report_errors();
|
||||
assert(sum(4, a) == 10);
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user