summaryrefslogtreecommitdiff
path: root/vendor/bandit/bandit/assertion_frameworks/snowhouse/example/expression_error_handling.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/bandit/bandit/assertion_frameworks/snowhouse/example/expression_error_handling.cpp')
-rw-r--r--vendor/bandit/bandit/assertion_frameworks/snowhouse/example/expression_error_handling.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/bandit/bandit/assertion_frameworks/snowhouse/example/expression_error_handling.cpp b/vendor/bandit/bandit/assertion_frameworks/snowhouse/example/expression_error_handling.cpp
new file mode 100644
index 00000000..de96f038
--- /dev/null
+++ b/vendor/bandit/bandit/assertion_frameworks/snowhouse/example/expression_error_handling.cpp
@@ -0,0 +1,28 @@
+#include <snowhouse/snowhouse.h>
+using namespace snowhouse;
+#include "tests.h"
+
+void ExpressionErrorHandling()
+{
+ std::cout << "================================================" << std::endl;
+ std::cout << " ExpressionErrorHandling" << std::endl;
+ std::cout << "================================================" << std::endl;
+
+ std::vector<int> collection;
+ collection.push_back(1);
+ collection.push_back(2);
+ collection.push_back(3);
+
+ std::cout << "AnInvalidAllOperationShouldBeReportedProperly" << std::endl;
+ {
+ AssertTestFails(Assert::That(collection, Has().All()),
+ "The expression after \"all\" operator does not yield any result");
+ }
+
+ std::cout << "AnInvalidAtLeastOperationShouldBeReportedProperly" << std::endl;
+ {
+ AssertTestFails(Assert::That(collection, Has().AtLeast(2)),
+ "The expression after \"at least 2\" operator does not yield any result");
+ }
+
+}