2017-01-16 18:40:55 +01:00
|
|
|
/*
|
|
|
|
* Created by Martin on 16/01/2017.
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
|
|
|
|
2017-01-14 21:55:37 +01:00
|
|
|
#include "catch.hpp"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
TEST_CASE("Successful tests -- REQUIRE", "[Success]") {
|
2017-09-18 18:13:17 +02:00
|
|
|
const std::size_t sz = 1 * 1024 * 1024;
|
2017-01-14 21:55:37 +01:00
|
|
|
|
|
|
|
|
2017-09-18 18:13:17 +02:00
|
|
|
std::vector<std::size_t> vec; vec.reserve(sz);
|
|
|
|
for (std::size_t i = 0; i < sz; ++i){
|
2017-01-14 21:55:37 +01:00
|
|
|
vec.push_back(i);
|
|
|
|
REQUIRE(vec.back() == i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
TEST_CASE("Successful tests -- CHECK", "[Success]") {
|
2017-09-18 18:13:17 +02:00
|
|
|
const std::size_t sz = 1 * 1024 * 1024;
|
2017-01-14 21:55:37 +01:00
|
|
|
|
|
|
|
|
2017-09-18 18:13:17 +02:00
|
|
|
std::vector<std::size_t> vec; vec.reserve(sz);
|
|
|
|
for (std::size_t i = 0; i < sz; ++i){
|
2017-01-14 21:55:37 +01:00
|
|
|
vec.push_back(i);
|
|
|
|
CHECK(vec.back() == i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
TEST_CASE("Unsuccessful tests -- CHECK", "[Failure]") {
|
2017-09-18 18:13:17 +02:00
|
|
|
const std::size_t sz = 1024 * 1024;
|
2017-01-14 21:55:37 +01:00
|
|
|
|
|
|
|
|
2017-09-18 18:13:17 +02:00
|
|
|
std::vector<std::size_t> vec; vec.reserve(sz);
|
|
|
|
for (std::size_t i = 0; i < sz; ++i){
|
2017-01-14 21:55:37 +01:00
|
|
|
vec.push_back(i);
|
|
|
|
CHECK(vec.size() == i);
|
|
|
|
}
|
|
|
|
}
|