Sha256: 1129eaba03805b850a806a367c66162f2143cee09701a0d57fa770bf3b4b8a63
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
// // test-RegexMatch.cc // snowcrash // // Created by Zdenek Nemec on 5/2/13. // Copyright (c) 2013 Apiary Inc. All rights reserved. // #include "catch.hpp" #include "RegexMatch.h" using namespace snowcrash; TEST_CASE("regexmatch/simple", "Simple regex test") { REQUIRE(RegexMatch("The quick brown fox jumps over the lazy dog", "fox[[:space:]]") == true); REQUIRE(RegexMatch("The quick brown fox jumps over the lazy dog", "box") == false); } TEST_CASE("regexmatch/complex", "Complex regex test") { REQUIRE(RegexMatch("The quick brown fox jumps over the lazy dog", "[[:space:]]{2}fox[[:space:]]jumps+") == true); REQUIRE(RegexMatch("The quick brown fox jumps over the lazy dog", "^The") == true); REQUIRE(RegexMatch("The quick brown fox jumps over the lazy dog", "[[:space:]]{2}fox[[:space:]]sjumps+") == false); } TEST_CASE("regexmatch/resource-header", "Match resource test") { REQUIRE(RegexMatch("HEAD /resource/{id}", "^((GET|HEAD)[[:space:]]+)?/.*$") == true); } TEST_CASE("regexmatch/request-payload", "Match request payload test") { REQUIRE(RegexMatch("Request My Id (application/json)", "^[Rr]equest([[:space:]]+([A-Za-z0-9_]|[[:space:]])*)?([[:space:]]\\([^\\)]*\\))?$") == true); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redsnow-0.3.2 | ext/snowcrash/test/test-RegexMatch.cc |