diff options
author | Manoj Srivastava <srivasta@debian.org> | 2016-01-27 12:43:59 -0800 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2016-01-27 12:50:09 -0800 |
commit | 76fce162659078323fcd5e54b3195dae371faca2 (patch) | |
tree | c1d93d415b96238aae3c54eb83cb0815af2e4bca /vendor/bandit/bandit/assertion_frameworks/snowhouse/example/string_tests.cpp | |
parent | b4456969cd02d75c599a5b86b225c0774697e85d (diff) | |
parent | 4aa1a39402c3908e9e8b6eb3fd4e2183d5e5c52e (diff) |
Merge branch 'development' into upstream
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
# Conflicts:
# src/.gitignore
# src/maid-x11.c
# src/quest.pkg
Diffstat (limited to 'vendor/bandit/bandit/assertion_frameworks/snowhouse/example/string_tests.cpp')
-rw-r--r-- | vendor/bandit/bandit/assertion_frameworks/snowhouse/example/string_tests.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/vendor/bandit/bandit/assertion_frameworks/snowhouse/example/string_tests.cpp b/vendor/bandit/bandit/assertion_frameworks/snowhouse/example/string_tests.cpp new file mode 100644 index 00000000..989ad42b --- /dev/null +++ b/vendor/bandit/bandit/assertion_frameworks/snowhouse/example/string_tests.cpp @@ -0,0 +1,65 @@ +#include <snowhouse/snowhouse.h> +using namespace snowhouse; +#include "tests.h" + +void StringTests() +{ + std::cout << "================================================" << std::endl; + std::cout << " StringTests" << std::endl; + std::cout << "================================================" << std::endl; + + std::cout << "ShouldHandleStringContainsConstraint" << std::endl; + { + Assert::That("abcdef", Contains("bcde")); + } + + std::cout << "StringConstraintShouldHandleMatchAtBeginningOfString" << std::endl; + { + Assert::That("abcdef", Contains("a")); + } + + std::cout << "ShouldDetectFailingContains" << std::endl; + { + AssertTestFails(Assert::That("abcdef", Contains("hello")), "contains hello"); + } + + std::cout << "ShouldHandleStringStartingWithConstraint" << std::endl; + { + Assert::That("abcdef", StartsWith("abc")); + } + + std::cout << "ShouldHandleStringEndingWithConstraint" << std::endl; + { + Assert::That("abcdef", EndsWith("def")); + } + + std::cout << "ShouldHandleOperatorsForStrings" << std::endl; + { + Assert::That("abcdef", StartsWith("ab") && EndsWith("ef")); + } + + std::cout << "ShouldHandleStringsWithMultipleOperators" << std::endl; + { + Assert::That("abcdef", StartsWith("ab") && !EndsWith("qwqw")); + } + + std::cout << "ShouldHandleOfLength" << std::endl; + { + Assert::That("12345", HasLength(5)); + } + + std::cout << "ShouldHandleWeirdLongExpressions" << std::endl; + { + Assert::That("12345", HasLength(5) && StartsWith("123") && !EndsWith("zyxxy")); + } + + std::cout << "ShouldHandleStdStrings" << std::endl; + { + Assert::That("12345", Contains(std::string("23"))); + } + + std::cout << "ShouldHandleSimpleChar" << std::endl; + { + Assert::That("12345", StartsWith('1')); + } +} |