Add deps project submodules

This commit is contained in:
Théophile Diot 2023-06-28 11:26:04 -04:00
parent b27f38349b
commit dd295729bb
No known key found for this signature in database
GPG Key ID: E752C80DB72BB014
517 changed files with 170813 additions and 19 deletions

View File

@ -0,0 +1,10 @@
# Introduction
The following are a set of Swig generated Python bindings for libmodsecurity. These bindings will allow users to utilize the exposed libmodsecurity interfaces directly from python, without the use of ctypes.
# Compilation
Although these are python scripts DO NOT use setup.py to compile this. Instead, one should use the Makefile in order to compile these. This can be done by typing 'make'. Be aware that the Python development headers are required to build this package. These can be obtained on RHEL via 'dnf install python-devel'

View File

@ -0,0 +1 @@
from modsecurity import *

View File

@ -0,0 +1,63 @@
/*
* ModSecurity, http://www.modsecurity.org/
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
*
* You may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* If any of the files related to licensing are missing or if you have any
* other questions related to licensing please contact Trustwave Holdings, Inc.
* directly using the email address security@modsecurity.org.
*
* Author: Felipe "Zimmerle" Costa <fcosta at trustwave dot com>
*
*/
%module modsecurity
%include "std_string.i"
%include "std_vector.i"
%include "std_sstream.i"
%include "attribute.i"
%include "carrays.i"
%include "typemaps.i"
#%ignore RulesProperties::parserError;
%{
#include "modsecurity/intervention.h"
#include "modsecurity/transaction/variable.h"
#include "modsecurity/transaction/variables.h"
#include "modsecurity/transaction/collection.h"
#include "modsecurity/transaction/collections.h"
#include "modsecurity/transaction.h"
#include "modsecurity/debug_log.h"
#include "modsecurity/modsecurity.h"
#include "modsecurity/rules_properties.h"
#include "modsecurity/rules.h"
#include "modsecurity/rule.h"
using std::basic_string;
%}
%ignore modsecurity::RulesProperties::parserError const;
%include "modsecurity/intervention.h"
%include "modsecurity/transaction/variable.h"
%include "modsecurity/transaction/variables.h"
%include "modsecurity/transaction/collection.h"
%include "modsecurity/transaction/collections.h"
%include "modsecurity/transaction.h"
%include "modsecurity/debug_log.h"
%include "modsecurity/modsecurity.h"
%include "modsecurity/rules_properties.h"
%include "modsecurity/rules.h"
%include "modsecurity/rule.h"
%template(RuleVector) std::vector<modsecurity::Rule *>;
%template(VectorOfRuleVector) std::vector<std::vector<modsecurity::Rule *> >;
%template(StringVector) std::vector<std::string>;

View File

@ -0,0 +1,107 @@
#!/usr/bin/env python
"""
ModSecurity, http://www.modsecurity.org/
Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
You may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
If any of the files related to licensing are missing or if you have any
other questions related to licensing please contact Trustwave Holdings, Inc.
directly using the email address security@modsecurity.org.
Author: Felipe "Zimmerle" Costa <fcosta at trustwave dot com>
"""
from distutils.core import setup, Extension
import os
import sys
possible_modsecurity_dirs = [
"/usr/local/modsecurity/",
"/usr/",
"/usr/local/"
]
libraries_dir = [
"lib/",
"lib64/"
]
headers_dir = [
"include/",
"headers/",
"./"
]
def find_modsec():
for i in possible_modsecurity_dirs:
lib = None
inc = None
for j in libraries_dir:
p = os.path.join(i, j, "libmodsecurity.so")
if os.path.isfile(p) or os.path.islink(p):
lib = os.path.join(i, j)
for x in headers_dir:
p = os.path.join(i, x, os.path.join("modsecurity", "modsecurity.h"))
if os.path.isfile(p) or os.path.islink(p):
inc = os.path.join(i, x)
if inc != None and lib != None:
return (inc, lib)
return (None, None)
inc_dir, lib_dir = find_modsec()
print "*** found modsecurity at:"
print " headers: " + str(inc_dir)
print " library: " + str(lib_dir)
if inc_dir == None or lib_dir == None:
print "libModSecurity was not found in your system."
print "Make sure you have libModSecurity correctly installed in your system."
sys.exit(1)
#if os.path.isfile("modsecurity/_modsecurity_module.cc") == False:
# print "Swig generated code was not found. Please run `make' first"
# sys.exit(1)
extension_mod = Extension(
"_modsecurity", [
"modsecurity/modsecurity_wrap.cxx"
],
libraries=["modsecurity"],
swig_opts=['-Wextra', '-builtin'],
library_dirs=[lib_dir],
runtime_library_dirs=[lib_dir],
include_dirs=[inc_dir, "."],
extra_compile_args=["-std=c++11"]
)
setup(
name = "modsecurity",
description = 'Python Bindings for libModSecurity',
author = 'Felipe Zimmerle',
author_email = 'felipe@zimmerle.org',
url = 'https://github.com/SpiderLabs/ModSecurity-Python-bindings',
ext_modules = [extension_mod],
packages = ['modsecurity'],
classifiers = [
'Topic :: Security',
'Topic :: Internet :: WWW/HTTP'
]
)

View File

@ -0,0 +1,54 @@
#!/usr/bin/env python
"""
ModSecurity, http://www.modsecurity.org/
Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
You may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
If any of the files related to licensing are missing or if you have any
other questions related to licensing please contact Trustwave Holdings, Inc.
directly using the email address security@modsecurity.org.
Author: Felipe "Zimmerle" Costa <fcosta at trustwave dot com>
"""
import sys
import unittest
sys.path.append("..")
sys.path.append(".")
import modsecurity
class TestStringMethods(unittest.TestCase):
def test_version(self):
self.assertRegexpMatches(str(modsecurity.ModSecurity().whoAmI()), ".*ModSecurity.*")
def test_load_rules(self):
rules = modsecurity.Rules()
ret = rules.load('SecRule ARGS_POST|XML:/* "(\n|\r)" "id:1,deny,phase:2"')
self.assertEqual(ret, 1)
ret = rules.load("""
SecRule ARGS_POST|XML:/* "(\n|\r)" "id:1,deny,phase:2"
SecRule ARGS_POST|XML:/* "(\n|\r)" "id:2,deny,phase:2"
""")
self.assertEqual(ret, 2)
ret = rules.getRulesForPhase(3)
self.assertEqual(ret.size(), 3)
def test_load_bad_rules(self):
rules = modsecurity.Rules()
ret = rules.load('SecRule ARGS_POST|XML:/* "(\n|\r)" "deny,phase:2"')
self.assertEqual(ret, -1)
ret = rules.getParserError()
self.assertRegexpMatches(ret, "Rules must have an ID.*")
if __name__ == '__main__':
unittest.main()

View File

@ -1,19 +0,0 @@
--- /dev/null
+++ /dev/null
@@ -322,12 +322,12 @@
# Decide if we want to build the tests or not.
-buildTestUtilities=false
-if test "x$YAJL_FOUND" = "x1"; then
+# buildTestUtilities=false
+# if test "x$YAJL_FOUND" = "x1"; then
# Regression tests will not be able to run without the logging support.
# But we still have the unit tests.
# if test "$debugLogs" = "true"; then
- buildTestUtilities=true
+# buildTestUtilities=true
# fi
-fi
+# fi

View File

@ -0,0 +1,2 @@
*.log
*.trs

View File

@ -0,0 +1,43 @@
# SecRules Test Set (STS)
STS was built to support the development of new implementations of SecRules, and also to avoid regression on the existing ones. The STS does not have any test script, containing only test cases.
This repository does not include all the operators supported by ModSecurity. This repository contains operators that are not supported by ModSecurity yet.
The tests in this repository came from ModSecurity unit tests (originally saved in the format of a Perl script). These tests were converted from Perl to JSON to make them easier to be opened (and parsed) in different platforms.
## How does it work?
All the test cases are saved into text files in JSON format. Every file contains an array of hashes, as illustrated below:
```
{
"ret" : 0,
"type" : "op",
"name" : "gt",
"param" : "0",
"input" : ""
},
```
The hashes describe the operator to be used with a given parameter and input content to be tested. The outcome result is also part of the hash, allowing the verification if the target application is working as expected.
## Test Organization
The directory "operators" contains unit tests for the SecRules operators. The file names are given after the operator name. Notice that the file name is just a matter of organization, and it does not interfere in the test. The operator name is also made explicit inside the test structure.
The hash that describes a unit test is disposed in the following structure:
- ret: Return code, can be 1 or 0 (True or False)
- type: Always "op"
- name: Operator name
- param: Operator parameter
- input: Input data
## How do I add STS to my implementation?
It is recommended to add this repository as a git submodule:
$ git submodule add https://github.com/SpiderLabs/secrules-language-tests

View File

@ -0,0 +1,44 @@
[
{
"input" : "",
"param" : "",
"name" : "beginsWith",
"type" : "op",
"ret" : 1
},
{
"param" : "TestCase",
"input" : "",
"name" : "beginsWith",
"ret" : 0,
"type" : "op"
},
{
"name" : "beginsWith",
"ret" : 1,
"type" : "op",
"param" : "",
"input" : "TestCase"
},
{
"param" : "abcdef",
"input" : "abcdef",
"ret" : 1,
"type" : "op",
"name" : "beginsWith"
},
{
"param" : "abcdef",
"input" : "abcdefghi",
"ret" : 1,
"type" : "op",
"name" : "beginsWith"
},
{
"name" : "beginsWith",
"type" : "op",
"ret" : 0,
"param" : "abcdef",
"input" : "abc"
}
]

View File

@ -0,0 +1,72 @@
[
{
"param" : "",
"input" : "",
"name" : "contains",
"type" : "op",
"ret" : 1
},
{
"name" : "contains",
"ret" : 0,
"type" : "op",
"input" : "",
"param" : "TestCase"
},
{
"input" : "TestCase",
"param" : "",
"type" : "op",
"ret" : 1,
"name" : "contains"
},
{
"input" : "abcdefghi",
"param" : "abc",
"type" : "op",
"ret" : 1,
"name" : "contains"
},
{
"name" : "contains",
"ret" : 1,
"type" : "op",
"param" : "def",
"input" : "abcdefghi"
},
{
"name" : "contains",
"ret" : 1,
"type" : "op",
"param" : "ghi",
"input" : "abcdefghi"
},
{
"input" : "abcdefghi",
"param" : "ghij",
"name" : "contains",
"type" : "op",
"ret" : 0
},
{
"input" : "x",
"param" : "x",
"name" : "contains",
"ret" : 1,
"type" : "op"
},
{
"ret" : 1,
"type" : "op",
"name" : "contains",
"input" : "xyz",
"param" : "y"
},
{
"param" : "hiding",
"input" : "hidinX<-not quite, but is later on->hiding",
"ret" : 1,
"type" : "op",
"name" : "contains"
}
]

View File

@ -0,0 +1,107 @@
[
{
"param" : "",
"input" : "",
"name" : "containsWord",
"type" : "op",
"ret" : 1
},
{
"param" : "TestCase",
"input" : "",
"name" : "containsWord",
"type" : "op",
"ret" : 0
},
{
"type" : "op",
"ret" : 1,
"name" : "containsWord",
"input" : "TestCase",
"param" : ""
},
{
"param" : "abc",
"input" : "abcdefghi",
"ret" : 0,
"type" : "op",
"name" : "containsWord"
},
{
"param" : "def",
"input" : "abcdefghi",
"type" : "op",
"ret" : 0,
"name" : "containsWord"
},
{
"input" : "abcdefghi",
"param" : "ghi",
"type" : "op",
"ret" : 0,
"name" : "containsWord"
},
{
"name" : "containsWord",
"type" : "op",
"ret" : 1,
"param" : "abc",
"input" : "abc def ghi"
},
{
"name" : "containsWord",
"type" : "op",
"ret" : 1,
"input" : "abc def ghi",
"param" : "def"
},
{
"type" : "op",
"ret" : 1,
"name" : "containsWord",
"param" : "ghi",
"input" : "abc def ghi"
},
{
"param" : "abc",
"input" : "abc\\0def ghi",
"name" : "containsWord",
"type" : "op",
"ret" : 1
},
{
"param" : "def",
"input" : "abc\\0def ghi",
"name" : "containsWord",
"type" : "op",
"ret" : 1
},
{
"name" : "containsWord",
"ret" : 1,
"type" : "op",
"input" : "x",
"param" : "x"
},
{
"type" : "op",
"ret" : 1,
"name" : "containsWord",
"param" : "x",
"input" : " x "
},
{
"input" : "xyz",
"param" : "y",
"name" : "containsWord",
"ret" : 0,
"type" : "op"
},
{
"name" : "containsWord",
"ret" : 1,
"type" : "op",
"input" : "hidingX<-not on word boundary, but is later on->hiding",
"param" : "hiding"
}
]

View File

@ -0,0 +1,20 @@
[
{
"input" : "",
"name" : "detectSQLi",
"ret" : 0,
"type" : "op"
},
{
"type" : "op",
"ret" : 0,
"name" : "detectSQLi",
"input" : "this is not isqli"
},
{
"input" : "ascii(substring(version() from 1 for 1))",
"type" : "op",
"ret" : 1,
"name" : "detectSQLi"
}
]

View File

@ -0,0 +1,20 @@
[
{
"input" : "",
"type" : "op",
"ret" : 0,
"name" : "detectXSS"
},
{
"ret" : 0,
"type" : "op",
"name" : "detectXSS",
"input" : "this is not an XSS"
},
{
"input" : "<a href=\"javascript:alert(1)\">)",
"ret" : 1,
"type" : "op",
"name" : "detectXSS"
}
]

View File

@ -0,0 +1,51 @@
[
{
"name" : "endsWith",
"type" : "op",
"ret" : 1,
"param" : "",
"input" : ""
},
{
"type" : "op",
"ret" : 0,
"name" : "endsWith",
"param" : "TestCase",
"input" : ""
},
{
"input" : "TestCase",
"param" : "",
"type" : "op",
"ret" : 1,
"name" : "endsWith"
},
{
"input" : "abcdefghi",
"param" : "abc",
"ret" : 0,
"type" : "op",
"name" : "endsWith"
},
{
"input" : "abcdefghi",
"param" : "def",
"type" : "op",
"ret" : 0,
"name" : "endsWith"
},
{
"input" : "abcdefghi",
"param" : "ghi",
"name" : "endsWith",
"type" : "op",
"ret" : 1
},
{
"input" : "abcdef\\0ghi",
"param" : "ghi",
"type" : "op",
"ret" : 1,
"name" : "endsWith"
}
]

View File

@ -0,0 +1,93 @@
[
{
"input" : "",
"param" : "0",
"type" : "op",
"ret" : 1,
"name" : "eq"
},
{
"param" : "5",
"input" : "",
"name" : "eq",
"ret" : 0,
"type" : "op"
},
{
"name" : "eq",
"ret" : 1,
"type" : "op",
"input" : "0",
"param" : "xxx"
},
{
"param" : "xxx",
"input" : "5",
"name" : "eq",
"ret" : 0,
"type" : "op"
},
{
"input" : "-1",
"param" : "xxx",
"type" : "op",
"ret" : 0,
"name" : "eq"
},
{
"param" : "0",
"input" : "xxx",
"name" : "eq",
"type" : "op",
"ret" : 1
},
{
"input" : "xxx",
"param" : "5",
"name" : "eq",
"ret" : 0,
"type" : "op"
},
{
"name" : "eq",
"type" : "op",
"ret" : 0,
"param" : "0",
"input" : "-5"
},
{
"param" : "0",
"input" : "0",
"name" : "eq",
"type" : "op",
"ret" : 1
},
{
"type" : "op",
"ret" : 0,
"name" : "eq",
"input" : "5",
"param" : "0"
},
{
"input" : "0",
"param" : "5",
"ret" : 0,
"type" : "op",
"name" : "eq"
},
{
"input" : "5",
"param" : "5",
"name" : "eq",
"type" : "op",
"ret" : 1
},
{
"ret" : 0,
"type" : "op",
"name" : "eq",
"input" : "10",
"param" : "5"
}
]

View File

@ -0,0 +1,86 @@
[
{
"type" : "op",
"ret" : 1,
"name" : "ge",
"input" : "",
"param" : "0"
},
{
"ret" : 0,
"type" : "op",
"name" : "ge",
"input" : "",
"param" : "5"
},
{
"input" : "5",
"param" : "xxx",
"name" : "ge",
"type" : "op",
"ret" : 1
},
{
"name" : "ge",
"ret" : 0,
"type" : "op",
"input" : "-1",
"param" : "xxx"
},
{
"name" : "ge",
"ret" : 1,
"type" : "op",
"input" : "xxx",
"param" : "0"
},
{
"name" : "ge",
"type" : "op",
"ret" : 0,
"input" : "xxx",
"param" : "5"
},
{
"ret" : 0,
"type" : "op",
"name" : "ge",
"param" : "0",
"input" : "-5"
},
{
"input" : "0",
"param" : "0",
"type" : "op",
"ret" : 1,
"name" : "ge"
},
{
"param" : "0",
"input" : "5",
"ret" : 1,
"type" : "op",
"name" : "ge"
},
{
"param" : "5",
"input" : "0",
"name" : "ge",
"ret" : 0,
"type" : "op"
},
{
"ret" : 1,
"type" : "op",
"name" : "ge",
"input" : "5",
"param" : "5"
},
{
"param" : "5",
"input" : "10",
"name" : "ge",
"ret" : 1,
"type" : "op"
}
]

View File

@ -0,0 +1,42 @@
[
{
"name" : "geoLookup",
"type" : "op",
"resource": "geoip",
"ret" : 0,
"param" : "",
"input" : ""
},
{
"type" : "op",
"ret" : 0,
"resource": "geoip",
"name" : "geoLookup",
"param" : "TestCase",
"input" : ""
},
{
"ret" : 0,
"type" : "op",
"resource": "geoip",
"name" : "geoLookup",
"input" : "127.0.0.1",
"param" : ""
},
{
"input" : "216.75.21.122",
"param" : "",
"resource": "geoip",
"ret" : 0,
"type" : "op",
"name" : "geoLookup"
},
{
"input" : "www.modsecurity.org",
"param" : "",
"resource": "geoip",
"type" : "op",
"ret" : 0,
"name" : "geoLookup"
}
]

View File

@ -0,0 +1,86 @@
[
{
"ret" : 0,
"type" : "op",
"name" : "gt",
"param" : "0",
"input" : ""
},
{
"param" : "5",
"input" : "",
"ret" : 0,
"type" : "op",
"name" : "gt"
},
{
"name" : "gt",
"ret" : 1,
"type" : "op",
"param" : "xxx",
"input" : "5"
},
{
"name" : "gt",
"type" : "op",
"ret" : 0,
"param" : "xxx",
"input" : "-1"
},
{
"param" : "-1",
"input" : "xxx",
"name" : "gt",
"ret" : 1,
"type" : "op"
},
{
"name" : "gt",
"type" : "op",
"ret" : 0,
"param" : "5",
"input" : "xxx"
},
{
"name" : "gt",
"type" : "op",
"ret" : 0,
"param" : "0",
"input" : "-5"
},
{
"name" : "gt",
"ret" : 0,
"type" : "op",
"param" : "0",
"input" : "0"
},
{
"name" : "gt",
"type" : "op",
"ret" : 1,
"param" : "0",
"input" : "5"
},
{
"ret" : 0,
"type" : "op",
"name" : "gt",
"param" : "5",
"input" : "0"
},
{
"type" : "op",
"ret" : 0,
"name" : "gt",
"param" : "5",
"input" : "5"
},
{
"param" : "5",
"input" : "10",
"type" : "op",
"ret" : 1,
"name" : "gt"
}
]

View File

@ -0,0 +1,86 @@
[
{
"input" : "",
"param" : "0",
"ret" : 1,
"type" : "op",
"name" : "le"
},
{
"param" : "5",
"input" : "",
"name" : "le",
"type" : "op",
"ret" : 1
},
{
"type" : "op",
"ret" : 0,
"name" : "le",
"param" : "xxx",
"input" : "5"
},
{
"input" : "-1",
"param" : "xxx",
"ret" : 1,
"type" : "op",
"name" : "le"
},
{
"type" : "op",
"ret" : 1,
"name" : "le",
"input" : "xxx",
"param" : "0"
},
{
"input" : "xxx",
"param" : "5",
"type" : "op",
"ret" : 1,
"name" : "le"
},
{
"param" : "0",
"input" : "-5",
"name" : "le",
"ret" : 1,
"type" : "op"
},
{
"name" : "le",
"ret" : 1,
"type" : "op",
"input" : "0",
"param" : "0"
},
{
"ret" : 0,
"type" : "op",
"name" : "le",
"param" : "0",
"input" : "5"
},
{
"input" : "0",
"param" : "5",
"name" : "le",
"ret" : 1,
"type" : "op"
},
{
"input" : "5",
"param" : "5",
"name" : "le",
"ret" : 1,
"type" : "op"
},
{
"type" : "op",
"ret" : 0,
"name" : "le",
"input" : "10",
"param" : "5"
}
]

View File

@ -0,0 +1,86 @@
[
{
"input" : "",
"param" : "0",
"name" : "lt",
"type" : "op",
"ret" : 0
},
{
"param" : "5",
"input" : "",
"name" : "lt",
"type" : "op",
"ret" : 1
},
{
"name" : "lt",
"type" : "op",
"ret" : 0,
"input" : "5",
"param" : "xxx"
},
{
"input" : "-1",
"param" : "xxx",
"name" : "lt",
"ret" : 1,
"type" : "op"
},
{
"type" : "op",
"ret" : 0,
"name" : "lt",
"param" : "-1",
"input" : "xxx"
},
{
"param" : "5",
"input" : "xxx",
"ret" : 1,
"type" : "op",
"name" : "lt"
},
{
"name" : "lt",
"ret" : 1,
"type" : "op",
"param" : "0",
"input" : "-5"
},
{
"name" : "lt",
"ret" : 0,
"type" : "op",
"input" : "0",
"param" : "0"
},
{
"param" : "0",
"input" : "5",
"ret" : 0,
"type" : "op",
"name" : "lt"
},
{
"param" : "5",
"input" : "0",
"name" : "lt",
"type" : "op",
"ret" : 1
},
{
"name" : "lt",
"type" : "op",
"ret" : 0,
"input" : "5",
"param" : "5"
},
{
"param" : "5",
"input" : "10",
"name" : "lt",
"type" : "op",
"ret" : 0
}
]

View File

@ -0,0 +1,23 @@
[
{
"input" : "",
"param" : "",
"name" : "noMatch",
"type" : "op",
"ret" : 0
},
{
"input" : "",
"param" : "TestCase",
"name" : "noMatch",
"ret" : 0,
"type" : "op"
},
{
"input" : "TestCase",
"param" : "",
"type" : "op",
"ret" : 0,
"name" : "noMatch"
}
]

View File

@ -0,0 +1,4 @@
abc
def
ghi
xxx yyy zzz

View File

@ -0,0 +1,107 @@
[
{
"type" : "op",
"ret" : 0,
"name" : "pm",
"input" : "",
"param" : "TestCase"
},
{
"param" : "abc",
"input" : "abcdefghi",
"type" : "op",
"ret" : 1,
"name" : "pm"
},
{
"name" : "pm",
"ret" : 1,
"type" : "op",
"param" : "def",
"input" : "abcdefghi"
},
{
"name" : "pm",
"ret" : 1,
"type" : "op",
"input" : "abcdefghi",
"param" : "ghi"
},
{
"param" : "ghij",
"input" : "abcdefghi",
"name" : "pm",
"ret" : 0,
"type" : "op"
},
{
"ret" : 1,
"type" : "op",
"name" : "pm",
"input" : "abcxxxyyy",
"param" : "abc def ghi"
},
{
"input" : "xxxabcyyy",
"param" : "abc def ghi",
"name" : "pm",
"ret" : 1,
"type" : "op"
},
{
"name" : "pm",
"type" : "op",
"ret" : 1,
"input" : "xxxyyyabc",
"param" : "abc def ghi"
},
{
"ret" : 1,
"type" : "op",
"name" : "pm",
"param" : "abc def ghi",
"input" : "defxxxyyy"
},
{
"type" : "op",
"ret" : 1,
"name" : "pm",
"param" : "abc def ghi",
"input" : "xxxdefyyy"
},
{
"name" : "pm",
"type" : "op",
"ret" : 1,
"input" : "xxxyyydef",
"param" : "abc def ghi"
},
{
"input" : "ghixxxyyy",
"param" : "abc def ghi",
"name" : "pm",
"type" : "op",
"ret" : 1
},
{
"param" : "abc def ghi",
"input" : "xxxghiyyy",
"ret" : 1,
"type" : "op",
"name" : "pm"
},
{
"type" : "op",
"ret" : 1,
"name" : "pm",
"input" : "xxxyyyghi",
"param" : "abc def ghi"
},
{
"param" : "000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999",
"input" : "xxxyyy999",
"type" : "op",
"ret" : 1,
"name" : "pm"
}
]

View File

@ -0,0 +1,44 @@
[
{
"name" : "pmFromFile",
"type" : "op",
"ret" : 0,
"input" : "xxxyyyzzz",
"param" : "test-cases/secrules-language-tests/operators/op/pmFromFile-01.dat"
},
{
"param" : "test-cases/secrules-language-tests/operators/op/pmFromFile-01.dat",
"input" : "defxxxyyy",
"name" : "pmFromFile",
"type" : "op",
"ret" : 1
},
{
"name" : "pmFromFile",
"ret" : 1,
"type" : "op",
"param" : "test-cases/secrules-language-tests/operators/op/pmFromFile-01.dat",
"input" : "xxxdefyyy"
},
{
"name" : "pmFromFile",
"ret" : 1,
"type" : "op",
"input" : "xxxyyydef",
"param" : "test-cases/secrules-language-tests/operators/op/pmFromFile-01.dat"
},
{
"ret" : 1,
"type" : "op",
"name" : "pmFromFile",
"input" : "xxx yyy zzz",
"param" : "test-cases/secrules-language-tests/operators/op/pmFromFile-01.dat"
},
{
"ret" : 0,
"type" : "op",
"name" : "pmFromFile",
"param" : "test-cases/secrules-language-tests/operators/op/pmFromFile-01.dat",
"input" : "xxx yyy"
}
]

View File

@ -0,0 +1,154 @@
[
{
"param" : "test",
"input" : "qqtestqq",
"ret" : 1,
"type" : "op",
"name" : "rx"
},
{
"param" : "",
"input" : "",
"ret" : 1,
"type" : "op",
"name" : "rx"
},
{
"name" : "rx",
"type" : "op",
"ret" : 0,
"param" : "TestCase",
"input" : ""
},
{
"ret" : 1,
"type" : "op",
"name" : "rx",
"param" : "",
"input" : "TestCase"
},
{
"param" : "abc",
"input" : "abcdefghi",
"type" : "op",
"ret" : 1,
"name" : "rx"
},
{
"param" : "def",
"input" : "abcdefghi",
"type" : "op",
"ret" : 1,
"name" : "rx",
"re_groups": ["def"]
},
{
"param" : "ghi",
"input" : "abcdefghi",
"name" : "rx",
"type" : "op",
"ret" : 1,
"re_groups": ["ghi"]
},
{
"ret" : 0,
"type" : "op",
"name" : "rx",
"param" : "ghij",
"input" : "abcdefghi"
},
{
"ret" : 1,
"type" : "op",
"name" : "rx",
"param" : "(?i:(sleep\\((\\s*?)(\\d*?)(\\s*?)\\)|benchmark\\((.*?)\\,(.*?)\\)))",
"input" : "SELECT pg_sleep(10);"
},
{
"type" : "op",
"name" : "rx",
"param" : "(abc)(def)",
"input" : "abcdef",
"ret" : 1,
"re_groups": ["abcdef", "abc", "def"]
},
{
"type" : "op",
"name" : "rx",
"param" : "(a|b|1|2)(a|b|1|2)",
"input" : "a2b1",
"ret" : 1,
"re_groups": ["a2", "a", "2"]
},
{
"type" : "op",
"name" : "rx",
"param" : "<\\?(?!xml)",
"input" : "<?php",
"ret" : 1,
"re_groups": ["<?"]
},
{
"type" : "op",
"name" : "rx",
"param" : "<\\?(?!xml)",
"input" : "<?xml",
"ret" : 0
},
{
"type" : "op",
"name" : "rx",
"param" : "abc\ndef",
"input" : "abc\ndef",
"ret" : 1,
"re_groups": ["abc\ndef"]
},
{
"type" : "op",
"name" : "rx",
"param" : "[a-z]\n",
"input" : "a\nb\nc\n",
"ret" : 1,
"re_groups": ["a\n"]
},
{
"type" : "op",
"name" : "rx",
"param" : "[a-z]*",
"input" : "abkjgdsgk",
"ret" : 1,
"re_groups": ["abkjgdsgk"]
},
{
"type" : "op",
"name" : "rx",
"param" : "([a-z]*)",
"input" : "",
"ret" : 1,
"re_groups": ["", ""]
},
{
"type" : "op",
"name" : "rx",
"param" : "[a-z]*",
"input" : "aaa0bbb",
"ret" : 1,
"re_groups": ["aaa"]
},
{
"type" : "op",
"name" : "rx",
"param" : "[a-z]*",
"input" : "aaa00bbb",
"ret" : 1,
"re_groups": ["aaa"]
},
{
"type" : "op",
"name" : "rx",
"param" : "(a)(b?)(c)",
"input" : "ac",
"ret" : 1,
"re_groups": ["ac", "a", "", "c"]
}
]

View File

@ -0,0 +1,162 @@
[
{
"param" : "test",
"input" : "qqtestqq",
"ret" : 1,
"type" : "op",
"name" : "rxGlobal"
},
{
"param" : "",
"input" : "",
"ret" : 1,
"type" : "op",
"name" : "rxGlobal"
},
{
"name" : "rxGlobal",
"type" : "op",
"ret" : 0,
"param" : "TestCase",
"input" : ""
},
{
"ret" : 1,
"type" : "op",
"name" : "rxGlobal",
"param" : "",
"input" : "TestCase"
},
{
"param" : "abc",
"input" : "abcdefghi",
"type" : "op",
"ret" : 1,
"name" : "rxGlobal"
},
{
"param" : "def",
"input" : "abcdefghi",
"type" : "op",
"ret" : 1,
"name" : "rxGlobal",
"re_groups": ["def"]
},
{
"param" : "ghi",
"input" : "abcdefghi",
"name" : "rxGlobal",
"type" : "op",
"ret" : 1,
"re_groups": ["ghi"]
},
{
"ret" : 0,
"type" : "op",
"name" : "rxGlobal",
"param" : "ghij",
"input" : "abcdefghi"
},
{
"ret" : 1,
"type" : "op",
"name" : "rxGlobal",
"param" : "(?i:(sleep\\((\\s*?)(\\d*?)(\\s*?)\\)|benchmark\\((.*?)\\,(.*?)\\)))",
"input" : "SELECT pg_sleep(10);"
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "(abc)(def)",
"input" : "abcdef",
"ret" : 1,
"re_groups": ["abcdef", "abc", "def"]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "(a|b|1|2)(a|b|1|2)",
"input" : "a2b1",
"ret" : 1,
"re_groups": ["a2", "a", "2"]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "<\\?(?!xml)",
"input" : "<?php",
"ret" : 1,
"re_groups": ["<?"]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "<\\?(?!xml)",
"input" : "<?xml",
"ret" : 0
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "abc\ndef",
"input" : "abc\ndef",
"ret" : 1,
"re_groups": ["abc\ndef"]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "[a-z]\n",
"input" : "a\nb\nc\n",
"ret" : 1,
"re_groups": ["a\n"]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "[a-z]*",
"input" : "abkjgdsgk",
"ret" : 1,
"re_groups": ["abkjgdsgk"]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "([a-z]*)",
"input" : "",
"ret" : 1,
"re_groups": ["", ""]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "[a-z]*",
"input" : "aaa0bbb",
"ret" : 1,
"re_groups": ["aaa", "bbb"]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "[a-z]*",
"input" : "aaa00bbb",
"ret" : 1,
"re_groups": ["aaa", "bbb"]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "(a)(b?)(c)",
"input" : "ac",
"ret" : 1,
"re_groups": ["ac", "a", "", "c"]
},
{
"type" : "op",
"name" : "rxGlobal",
"param" : "(^|a)(b|c)(d)",
"input" : "bdacd",
"ret" : 1,
"re_groups": ["bd", "", "b", "d", "acd", "a", "c", "d"]
}
]

View File

@ -0,0 +1,51 @@
[
{
"input" : "",
"param" : "",
"name" : "streq",
"type" : "op",
"ret" : 1
},
{
"type" : "op",
"ret" : 0,
"name" : "streq",
"param" : "TestCase",
"input" : ""
},
{
"name" : "streq",
"type" : "op",
"ret" : 0,
"input" : "TestCase",
"param" : ""
},
{
"type" : "op",
"ret" : 0,
"name" : "streq",
"input" : "abcdefghi",
"param" : "abc"
},
{
"name" : "streq",
"type" : "op",
"ret" : 0,
"param" : "def",
"input" : "abcdefghi"
},
{
"ret" : 0,
"type" : "op",
"name" : "streq",
"input" : "abcdefghi",
"param" : "ghi"
},
{
"input" : "abcdefghi",
"param" : "abcdefghi",
"name" : "streq",
"type" : "op",
"ret" : 1
}
]

View File

@ -0,0 +1,37 @@
[
{
"param" : "TestCase",
"input" : "",
"name" : "strmatch",
"type" : "op",
"ret" : 0
},
{
"type" : "op",
"ret" : 1,
"name" : "strmatch",
"input" : "abcdefghi",
"param" : "abc"
},
{
"param" : "def",
"input" : "abcdefghi",
"type" : "op",
"ret" : 1,
"name" : "strmatch"
},
{
"input" : "abcdefghi",
"param" : "ghi",
"type" : "op",
"ret" : 1,
"name" : "strmatch"
},
{
"input" : "abcdefghi",
"param" : "ghij",
"name" : "strmatch",
"ret" : 0,
"type" : "op"
}
]

View File

@ -0,0 +1,23 @@
[
{
"input" : "",
"param" : "",
"name" : "unconditionalMatch",
"ret" : 1,
"type" : "op"
},
{
"name" : "unconditionalMatch",
"type" : "op",
"ret" : 1,
"input" : "",
"param" : "TestCase"
},
{
"ret" : 1,
"type" : "op",
"name" : "unconditionalMatch",
"input" : "TestCase",
"param" : ""
}
]

View File

@ -0,0 +1,58 @@
[
{
"ret" : 0,
"type" : "op",
"name" : "validateByteRange",
"input" : "",
"param" : "0-255"
},
{
"param" : "",
"input" : "TestCase",
"name" : "validateByteRange",
"ret" : 1,
"type" : "op"
},
{
"param" : "xxx",
"input" : "TestCase",
"type" : "op",
"ret" : 1,
"name" : "validateByteRange"
},
{
"param" : "xxx",
"input" : "\u0000",
"type" : "op",
"ret" : 0,
"name" : "validateByteRange"
},
{
"param" : "0-255",
"input" : "abcdefghi",
"name" : "validateByteRange",
"ret" : 0,
"type" : "op"
},
{
"name" : "validateByteRange",
"type" : "op",
"ret" : 0,
"input" : "abcdefghi",
"param" : "97-105"
},
{
"input" : "abcdefghij",
"param" : "97-105",
"name" : "validateByteRange",
"ret" : 1,
"type" : "op"
},
{
"input" : "\u00d0\u0090",
"param" : "0-255",
"name" : "validateByteRange",
"ret" : 0,
"type" : "op"
}
]

View File

@ -0,0 +1,100 @@
[
{
"input" : "",
"param" : "",
"name" : "validateUrlEncoding",
"type" : "op",
"ret" : 0
},
{
"param" : "",
"input" : "Hello%20World!",
"type" : "op",
"ret" : 0,
"name" : "validateUrlEncoding"
},
{
"param" : "",
"input" : "Hello+World!",
"ret" : 0,
"type" : "op",
"name" : "validateUrlEncoding"
},
{
"input" : "HelloWorld!",
"param" : "",
"ret" : 0,
"type" : "op",
"name" : "validateUrlEncoding"
},
{
"param" : "",
"input" : "%00Hello%20World!",
"ret" : 0,
"type" : "op",
"name" : "validateUrlEncoding"
},
{
"param" : "",
"input" : "Hello%20World!%00",
"type" : "op",
"ret" : 0,
"name" : "validateUrlEncoding"
},
{
"ret" : 0,
"type" : "op",
"name" : "validateUrlEncoding",
"input" : "%00",
"param" : ""
},
{
"param" : "",
"input" : "%ff",
"name" : "validateUrlEncoding",
"ret" : 0,
"type" : "op"
},
{
"ret" : 1,
"type" : "op",
"name" : "validateUrlEncoding",
"param" : "",
"input" : "%0"
},
{
"input" : "%f",
"param" : "",
"name" : "validateUrlEncoding",
"type" : "op",
"ret" : 1
},
{
"name" : "validateUrlEncoding",
"ret" : 1,
"type" : "op",
"param" : "",
"input" : "%"
},
{
"name" : "validateUrlEncoding",
"type" : "op",
"ret" : 1,
"input" : "%0z",
"param" : ""
},
{
"name" : "validateUrlEncoding",
"ret" : 1,
"type" : "op",
"input" : "%z0",
"param" : ""
},
{
"param" : "",
"input" : "%0%",
"ret" : 1,
"type" : "op",
"name" : "validateUrlEncoding"
}
]

View File

@ -0,0 +1,226 @@
[
{
"name" : "validateUtf8Encoding",
"type" : "op",
"ret" : 0,
"input" : "",
"param" : ""
},
{
"name" : "validateUtf8Encoding",
"ret" : 0,
"type" : "op",
"input" : "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει.",
"param" : ""
},
{
"input" : "Je peux manger du verre, ça ne me fait pas de mal.",
"param" : "",
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding"
},
{
"input" : "Puedo comer vidrio, no me hace daño.",
"param" : "",
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding"
},
{
"param" : "",
"input" : "Mi povas manĝi vitron, ĝi ne damaĝas min.",
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding"
},
{
"param" : "",
"input" : "Ic mæg glæs eotan ond hit ne hearmiað me.",
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding"
},
{
"name" : "validateUtf8Encoding",
"type" : "op",
"ret" : 0,
"input" : "Могу јести стакло а да ми не шкоди.",
"param" : ""
},
{
"param" : "",
"input" : "Я могу есть стекло, оно мне не вредит.",
"name" : "validateUtf8Encoding",
"ret" : 0,
"type" : "op"
},
{
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding",
"param" : "",
"input" : "Կրնամ ապակի ուտել և ինծի անհանգիստ չըներ։"
},
{
"name" : "validateUtf8Encoding",
"ret" : 0,
"type" : "op",
"param" : "",
"input" : "جام ييه بلورم بڭا ضررى طوقونمز"
},
{
"input" : "मैं काँच खा सकता हूँ, मुझे उस से कोई पीडा नहीं होती.",
"param" : "",
"name" : "validateUtf8Encoding",
"ret" : 0,
"type" : "op"
},
{
"name" : "validateUtf8Encoding",
"type" : "op",
"ret" : 0,
"param" : "",
"input" : "أنا قادر على أكل الزجاج و هذا لا يؤلمني."
},
{
"param" : "",
"input" : "אני יכול לאכול זכוכית וזה לא מזיק לי.",
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding"
},
{
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding",
"param" : "",
"input" : "私はガラスを食べられます。それは私を傷つけません。"
},
{
"param" : "",
"input" : "ฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บ",
"type" : "op",
"ret" : 0,
"name" : "validateUtf8Encoding"
},
{
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding",
"param" : "",
"input" : "나는 유리를 먹을 수 있어요. 그래도 아프지 않아요"
},
{
"input" : "Tsésǫʼ yishą́ągo bíí­shghah dóó doo shił neezgai da.",
"param" : "",
"name" : "validateUtf8Encoding",
"type" : "op",
"ret" : 0
},
{
"input" : ‰g get etið gler án þess að meiða mig.",
"param" : "",
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding"
},
{
"type" : "op",
"ret" : 0,
"name" : "validateUtf8Encoding",
"input" : "काचं शक्नोम्यत्तुम् । नोपहिनस्ति माम् ॥",
"param" : ""
},
{
"input" : "⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑",
"param" : "",
"name" : "validateUtf8Encoding",
"ret" : 0,
"type" : "op"
},
{
"name" : "validateUtf8Encoding",
"type" : "op",
"ret" : 0,
"param" : "",
"input" : "Jeg kan spise glas, det gør ikke ondt på mig."
},
{
"name" : "validateUtf8Encoding",
"ret" : 0,
"type" : "op",
"param" : "",
"input" : "Meg tudom enni az üveget, nem lesz tőle bajom."
},
{
"type" : "op",
"ret" : 0,
"name" : "validateUtf8Encoding",
"param" : "",
"input" : "Ma võin klaasi süüa, see ei tee mulle midagi."
},
{
"input" : "Mohu jíst sklo, neublíží mi.",
"param" : "",
"type" : "op",
"ret" : 0,
"name" : "validateUtf8Encoding"
},
{
"param" : "",
"input" : "Môžem jesť sklo. Nezraní ma.",
"name" : "validateUtf8Encoding",
"type" : "op",
"ret" : 0
},
{
"param" : "",
"input" : "Mogę jeść szkło i mi nie szkodzi.",
"type" : "op",
"ret" : 0,
"name" : "validateUtf8Encoding"
},
{
"param" : "",
"input" : ˆ®E⋅da=Qn→∞∑f(i)=∏g(i)∀ˆˆâ„ŒˆŒ‰ˆ’⌊−Œ‹Î±âˆ§Â¬Î²=¬(¬α∨β)ℕ⊆ℕ₀⊂ℤ⊂ℚ⊂ℝ⊂ℂ⊥<a≠‰¡c≤d≪⊤⇒(A⇔B)2H₂+O₂⇌2H₂OR=4.7kΩ⌀200mm‘’“”'´`‚‘„“†‡‰•3–€”−5/+5™…1lI|0OD8B€",
"ret" : 0,
"type" : "op",
"name" : "validateUtf8Encoding"
},
{
"input" : "\\0\\xe4",
"param" : "",
"name" : "validateUtf8Encoding",
"ret" : 1,
"type" : "op"
},
{
"name" : "validateUtf8Encoding",
"ret" : 1,
"type" : "op",
"input" : "\\xe4",
"param" : ""
},
{
"name" : "validateUtf8Encoding",
"type" : "op",
"ret" : 1,
"input" : "\\x03\\xbf",
"param" : ""
},
{
"type" : "op",
"ret" : 1,
"name" : "validateUtf8Encoding",
"input" : "\\xc9\\x3b",
"param" : ""
},
{
"name" : "validateUtf8Encoding",
"ret" : 1,
"type" : "op",
"param" : "",
"input" : "\\xFF\\0"
}
]

View File

@ -0,0 +1,485 @@
[
{
"input" : "",
"param" : "d+",
"name" : "verifyCC",
"type" : "op",
"ret" : 0
},
{
"input" : "",
"param" : "\\d*",
"name" : "verifyCC",
"ret" : 0,
"type" : "op"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 0,
"input" : "TestCase",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"name" : "verifyCC",
"ret" : 0,
"type" : "op",
"input" : "TestCase",
"param" : "TestCase"
},
{
"param" : ".*",
"input" : "TestCase",
"name" : "verifyCC",
"ret" : 0,
"type" : "op"
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "5484605089158216",
"name" : "verifyCC",
"ret" : 1,
"type" : "op"
},
{
"name" : "verifyCC",
"ret" : 1,
"type" : "op",
"input" : "5574407071707154",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"type" : "op",
"ret" : 1,
"name" : "verifyCC",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "5351341509714210"
},
{
"input" : "5585166974020647",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"type" : "op",
"ret" : 1,
"name" : "verifyCC"
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "5492180332479256",
"name" : "verifyCC",
"type" : "op",
"ret" : 1
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "5111178142162816",
"ret" : 1,
"type" : "op",
"name" : "verifyCC"
},
{
"ret" : 1,
"type" : "op",
"name" : "verifyCC",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "5511424748431031"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 1,
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "5259964281562326"
},
{
"ret" : 1,
"type" : "op",
"name" : "verifyCC",
"input" : "5138342589974385",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"input" : "5362069587634979",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"name" : "verifyCC",
"ret" : 1,
"type" : "op"
},
{
"input" : "4916545704601136",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"ret" : 1,
"type" : "op",
"name" : "verifyCC"
},
{
"name" : "verifyCC",
"ret" : 1,
"type" : "op",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "4539501231827691"
},
{
"name" : "verifyCC",
"ret" : 1,
"type" : "op",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "4556338049595394"
},
{
"input" : "4929326438756024",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"ret" : 1,
"type" : "op",
"name" : "verifyCC"
},
{
"type" : "op",
"ret" : 1,
"name" : "verifyCC",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "4485432027326322"
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "4532104980682081",
"type" : "op",
"ret" : 1,
"name" : "verifyCC"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 1,
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "4485974616349298"
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "4916580487207199",
"name" : "verifyCC",
"type" : "op",
"ret" : 1
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 1,
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "4532009746910413"
},
{
"name" : "verifyCC",
"ret" : 1,
"type" : "op",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "4024007144622932"
},
{
"input" : "4556324125126",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"type" : "op",
"ret" : 1,
"name" : "verifyCC"
},
{
"input" : "4067482954141",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"type" : "op",
"ret" : 1,
"name" : "verifyCC"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 1,
"input" : "4532402654980",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"input" : "4539709679875",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"name" : "verifyCC",
"ret" : 1,
"type" : "op"
},
{
"input" : "4024007182237",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"type" : "op",
"ret" : 1,
"name" : "verifyCC"
},
{
"type" : "op",
"ret" : 1,
"name" : "verifyCC",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "343918934573386"
},
{
"ret" : 1,
"type" : "op",
"name" : "verifyCC",
"input" : "344881778330710",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 1,
"input" : "345439478558905",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"input" : "346465614421111",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"name" : "verifyCC",
"type" : "op",
"ret" : 1
},
{
"type" : "op",
"ret" : 1,
"name" : "verifyCC",
"input" : "372263817755618",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "6011402777433576",
"name" : "verifyCC",
"type" : "op",
"ret" : 1
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "6011890045362751",
"name" : "verifyCC",
"type" : "op",
"ret" : 1
},
{
"ret" : 1,
"type" : "op",
"name" : "verifyCC",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "6011439091242416"
},
{
"type" : "op",
"ret" : 1,
"name" : "verifyCC",
"input" : "30162519308318",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 1,
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "30311556856867"
},
{
"type" : "op",
"ret" : 1,
"name" : "verifyCC",
"input" : "36850112043985",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 1,
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "201427829075664"
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "201434726660424",
"name" : "verifyCC",
"type" : "op",
"ret" : 1
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "201453368666085",
"name" : "verifyCC",
"type" : "op",
"ret" : 1
},
{
"ret" : 1,
"type" : "op",
"name" : "verifyCC",
"input" : "210091499965007",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"input" : "210072739882947",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"type" : "op",
"ret" : 1,
"name" : "verifyCC"
},
{
"input" : "180013970064072",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"type" : "op",
"ret" : 1,
"name" : "verifyCC"
},
{
"name" : "verifyCC",
"ret" : 1,
"type" : "op",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "3096676276259096"
},
{
"input" : "3158726040010070",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"ret" : 1,
"type" : "op",
"name" : "verifyCC"
},
{
"ret" : 1,
"type" : "op",
"name" : "verifyCC",
"input" : "3096531217494742",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"name" : "verifyCC",
"ret" : 1,
"type" : "op",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "869974262335041"
},
{
"ret" : 1,
"type" : "op",
"name" : "verifyCC",
"input" : "869905005856398",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)"
},
{
"input" : "869950500085465",
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"ret" : 1,
"type" : "op",
"name" : "verifyCC"
},
{
"param" : "(?:^|[^\\d])(\\d+)(?:[^\\d]|$)",
"input" : "1234567890012345",
"type" : "op",
"ret" : 0,
"name" : "verifyCC"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 1,
"input" : "4417123456789113",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)"
},
{
"name" : "verifyCC",
"ret" : 1,
"type" : "op",
"input" : "4408041234567893",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)"
},
{
"ret" : 0,
"type" : "op",
"name" : "verifyCC",
"input" : "4408041234567890",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)"
},
{
"ret" : 0,
"type" : "op",
"name" : "verifyCC",
"input" : "4417123456789112",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 1,
"input" : "a5484605089158216",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)"
},
{
"ret" : 1,
"type" : "op",
"name" : "verifyCC",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)",
"input" : "a5484605089158216b"
},
{
"type" : "op",
"ret" : 1,
"name" : "verifyCC",
"input" : "5484605089158216b",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)"
},
{
"name" : "verifyCC",
"ret" : 1,
"type" : "op",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)",
"input" : "5484-6050-8915-8216"
},
{
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)",
"input" : "5484605089158217",
"name" : "verifyCC",
"ret" : 0,
"type" : "op"
},
{
"input" : "5574407071807154",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)",
"type" : "op",
"ret" : 0,
"name" : "verifyCC"
},
{
"name" : "verifyCC",
"type" : "op",
"ret" : 0,
"input" : "5-484-6050-8915-8216",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)"
},
{
"ret" : 0,
"type" : "op",
"name" : "verifyCC",
"input" : "5484 6050 8915 8216",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)"
},
{
"input" : "15484605089158216",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)",
"name" : "verifyCC",
"ret" : 0,
"type" : "op"
},
{
"type" : "op",
"ret" : 0,
"name" : "verifyCC",
"input" : "154846050891582162",
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)"
},
{
"param" : "(?:^|[^\\d])(\\d{4}\\-?\\d{4}\\-?\\d{2}\\-?\\d{2}\\-?\\d{1,4})(?:[^\\d]|$)",
"input" : "54846050891582162",
"type" : "op",
"ret" : 0,
"name" : "verifyCC"
}
]

View File

@ -0,0 +1,19 @@
[
{
"param" : "([0-9]{3}\\.){2}[0-9]{3}-[0-9]{2}",
"input" : "asdf 010.817.514-60 asdf",
"ret" : 1,
"type" : "op",
"name" : "verifycpf"
},
{
"param" : "([0-9]{3}\\.){2}[0-9]{3}-[0-9]{2}",
"input" : "asdf 010.817 asdf",
"ret" : 0,
"type" : "op",
"name" : "verifycpf"
}
]

View File

@ -0,0 +1,32 @@
[
{
"param" : "\\d{3}-?\\d{2}-?\\d{4}",
"input" : "574-57-8065",
"ret" : 1,
"type" : "op",
"name" : "verifyssn"
},
{
"param" : "\\d{3}-?\\d{2}-?\\d{4}",
"input" : "asdf 574-57-8065 asdf",
"ret" : 1,
"type" : "op",
"name" : "verifyssn"
},
{
"param" : "\\d{3}-?\\d{2}-?\\d{4}",
"input" : "asdf 800-57-8065 asdf",
"ret" : 0,
"type" : "op",
"name" : "verifyssn"
},
{
"param" : "\\d{3}-?\\d{2}-?\\d{4}",
"input" : "asdf 123-45-6789 asdf",
"ret" : 0,
"type" : "op",
"name" : "verifyssn"
}
]

View File

@ -0,0 +1,26 @@
[
{
"param" : "([0-9]{4} ?[0-9]{6})",
"input" : "1237010180",
"ret" : 1,
"type" : "op",
"name" : "verifysvnr"
},
{
"param" : "([0-9]{4} ?[0-9]{6})",
"input" : "asdf 1237 010180 asdf",
"ret" : 1,
"type" : "op",
"name" : "verifysvnr"
},
{
"param" : "([0-9]{4} ?[0-9]{6})",
"input" : "asdf 0100817 asdf",
"ret" : 0,
"type" : "op",
"name" : "verifysvnr"
}
]

View File

@ -0,0 +1,51 @@
[
{
"param" : "",
"input" : "",
"name" : "within",
"type" : "op",
"ret" : 1
},
{
"name" : "within",
"type" : "op",
"ret" : 1,
"input" : "",
"param" : "TestCase"
},
{
"param" : "",
"input" : "TestCase",
"type" : "op",
"ret" : 0,
"name" : "within"
},
{
"input" : "abc",
"param" : "abcdefghi",
"ret" : 1,
"type" : "op",
"name" : "within"
},
{
"type" : "op",
"ret" : 1,
"name" : "within",
"param" : "abcdefghi",
"input" : "def"
},
{
"name" : "within",
"ret" : 1,
"type" : "op",
"input" : "ghi",
"param" : "abcdefghi"
},
{
"input" : "ghij",
"param" : "abcdefghi",
"name" : "within",
"type" : "op",
"ret" : 0
}
]

View File

@ -0,0 +1,44 @@
[
{
"ret" : 0,
"input" : "",
"type" : "tfn",
"name" : "base64Decode",
"output" : ""
},
{
"output" : "TestCase",
"ret" : 1,
"name" : "base64Decode",
"input" : "VGVzdENhc2U=",
"type" : "tfn"
},
{
"output" : "TestCase1",
"name" : "base64Decode",
"input" : "VGVzdENhc2Ux",
"type" : "tfn",
"ret" : 1
},
{
"ret" : 1,
"input" : "VGVzdENhc2UxMg==",
"name" : "base64Decode",
"type" : "tfn",
"output" : "TestCase12"
},
{
"output" : "Test\\u0000Case",
"input" : "VGVzdABDYXNl",
"name" : "base64Decode",
"type" : "tfn",
"ret" : 1
},
{
"type" : "tfn",
"input" : "VGVzdENhc2U=\\u0000VGVzdENhc2U=",
"name" : "base64Decode",
"ret" : 1,
"output" : "TestCase"
}
]

View File

@ -0,0 +1,44 @@
[
{
"ret" : 0,
"input" : "",
"type" : "tfn",
"name" : "base64DecodeExt",
"output" : ""
},
{
"output" : "TestCase",
"ret" : 1,
"name" : "base64DecodeExt",
"input" : "VGVzdENhc2U=",
"type" : "tfn"
},
{
"output" : "TestCase1",
"name" : "base64DecodeExt",
"input" : "VGVzdENhc2Ux",
"type" : "tfn",
"ret" : 1
},
{
"ret" : 1,
"input" : "VGVzdENhc2UxMg==",
"name" : "base64DecodeExt",
"type" : "tfn",
"output" : "TestCase12"
},
{
"ret" : 1,
"input" : "P.HNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==",
"name" : "base64DecodeExt",
"type" : "tfn",
"output" : "<script>alert(1)</script>"
},
{
"output" : "Test\\u0000Case",
"input" : "VGVzdABDYXNl",
"name" : "base64DecodeExt",
"type" : "tfn",
"ret" : 1
}
]

View File

@ -0,0 +1,37 @@
[
{
"output" : "",
"input" : "",
"type" : "tfn",
"name" : "base64Encode",
"ret" : 0
},
{
"input" : "TestCase",
"name" : "base64Encode",
"type" : "tfn",
"ret" : 1,
"output" : "VGVzdENhc2U="
},
{
"output" : "VGVzdENhc2Ux",
"ret" : 1,
"input" : "TestCase1",
"name" : "base64Encode",
"type" : "tfn"
},
{
"input" : "TestCase12",
"type" : "tfn",
"name" : "base64Encode",
"ret" : 1,
"output" : "VGVzdENhc2UxMg=="
},
{
"output" : "VGVzdABDYXNl",
"ret" : 1,
"name" : "base64Encode",
"input" : "Test\\u0000Case",
"type" : "tfn"
}
]

View File

@ -0,0 +1,45 @@
[
{
"name" : "cmd_line",
"input" : "",
"type" : "tfn",
"ret" : 0,
"output" : ""
},
{
"name" : "cmd_line",
"input" : "test",
"type" : "tfn",
"ret" : 1,
"output" : "test"
},
{
"name" : "cmd_line",
"input" : "C^OMMAND /C DIR",
"type" : "tfn",
"ret" : 1,
"output" : "command/c dir"
},
{
"name" : "cmd_line",
"input" : "C^oMMaNd /C DiR",
"type" : "tfn",
"ret" : 1,
"output" : "command/c dir"
},
{
"name" : "cmd_line",
"input" : "cmd,/c DiR",
"type" : "tfn",
"ret" : 1,
"output" : "cmd/c dir"
},
{
"name" : "cmd_line",
"input" : "\"command\" /c DiR",
"type" : "tfn",
"ret" : 1,
"output" : "command/c dir"
}
]

View File

@ -0,0 +1,44 @@
[
{
"ret" : 0,
"name" : "compressWhitespace",
"input" : "",
"type" : "tfn",
"output" : ""
},
{
"ret" : 0,
"type" : "tfn",
"input" : "TestCase",
"name" : "compressWhitespace",
"output" : "TestCase"
},
{
"name" : "compressWhitespace",
"input" : "Test\\u0000Case",
"type" : "tfn",
"ret" : 0,
"output" : "Test\\u0000Case"
},
{
"output" : "Test Case",
"ret" : 0,
"type" : "tfn",
"input" : "Test Case",
"name" : "compressWhitespace"
},
{
"output" : " Test Case ",
"ret" : 1,
"input" : " Test \t Case ",
"name" : "compressWhitespace",
"type" : "tfn"
},
{
"name" : "compressWhitespace",
"input" : "This is a test case with a tab \t, vtab \u000b, newline \n, return \r, formfeed \f, and a NUL\\u0000 in it with a CRLF at the end.\r\n",
"type" : "tfn",
"ret" : 1,
"output" : "This is a test case with a tab , vtab , newline , return , formfeed , and a NUL\\u0000 in it with a CRLF at the end. "
}
]

View File

@ -0,0 +1,44 @@
[
{
"input" : "",
"output" : "",
"name" : "cssDecode",
"ret" : 0,
"type" : "tfn"
},
{
"output" : "TestCase",
"name" : "cssDecode",
"input" : "TestCase",
"ret" : 0,
"type" : "tfn"
},
{
"input" : "Test\u0000Case",
"output" : "Test\u0000Case",
"name" : "cssDecode",
"ret" : 0,
"type" : "tfn"
},
{
"type" : "tfn",
"ret" : 1,
"input" : "test\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\\u0000\\12\\123\\1234\\12345\\123456\\ff01\\ff5e\\\n\\\u0000 string",
"name" : "cssDecode",
"output" : "test\n\u000b\u000fnrtv?'\"\u0000\u0012#4EV!~\u0000 string"
},
{
"input" : "test\\",
"output" : "test",
"name" : "cssDecode",
"ret" : 1,
"type" : "tfn"
},
{
"type" : "tfn",
"ret" : 1,
"input" : "\\1A\\1 A\\1234567\\123456 7\\1x\\1 x",
"name" : "cssDecode",
"output" : "\u001a\u0001AV7V7\u0001x\u0001x"
}
]

View File

@ -0,0 +1,100 @@
[
{
"output" : "",
"type" : "tfn",
"input" : "",
"name" : "escapeSeqDecode",
"ret" : 0
},
{
"name" : "escapeSeqDecode",
"input" : "TestCase",
"type" : "tfn",
"ret" : 0,
"output" : "TestCase"
},
{
"output" : "Test\\u0000Case",
"ret" : 0,
"type" : "tfn",
"input" : "Test\\u0000Case",
"name" : "escapeSeqDecode"
},
{
"ret" : 1,
"input" : "\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\x00\\xff",
"name" : "escapeSeqDecode",
"type" : "tfn",
"output" : "\u0007\b\f\n\r\t\u000b?'\"\\u0000\nS\\u0000\\xff"
},
{
"ret" : 1,
"type" : "tfn",
"input" : "\\a\\b\\f\\n\\r\\t\\v\\u0000\\?\\'\\\"\\0\\12\\123\\x00\\xff",
"name" : "escapeSeqDecode",
"output" : "\u0007\b\f\n\r\t\u000b\\u0000?'\"\\u0000\nS\\u0000\\xff"
},
{
"input" : "\\8\\9\\666\\xag\\xga\\0123",
"type" : "tfn",
"name" : "escapeSeqDecode",
"ret" : 1,
"output" : "89\\xb6\\xag\\xga\\x0a3"
},
{
"output" : "x",
"type" : "tfn",
"input" : "\\x",
"name" : "escapeSeqDecode",
"ret" : 1
},
{
"name" : "escapeSeqDecode",
"input" : "\\x\\x0",
"type" : "tfn",
"ret" : 1,
"output" : "xx0"
},
{
"output" : "xx0\\u0000",
"name" : "escapeSeqDecode",
"input" : "\\x\\x0\\u0000",
"type" : "tfn",
"ret" : 1
},
{
"name" : "escapeSeqDecode",
"input" : "\\0",
"type" : "tfn",
"ret" : 1,
"output" : "\\u0000"
},
{
"output" : "\u0001",
"ret" : 1,
"input" : "\\01",
"name" : "escapeSeqDecode",
"type" : "tfn"
},
{
"ret" : 1,
"name" : "escapeSeqDecode",
"input" : "\\012",
"type" : "tfn",
"output" : "\n"
},
{
"ret" : 0,
"type" : "tfn",
"input" : "\\",
"name" : "escapeSeqDecode",
"output" : "\\"
},
{
"input" : "\\\\u0000",
"type" : "tfn",
"name" : "escapeSeqDecode",
"ret" : 1,
"output" : "\\u0000"
}
]

View File

@ -0,0 +1,44 @@
[
{
"ret" : 1,
"input" : "",
"type" : "tfn",
"name" : "hexDecode",
"output" : ""
},
{
"output" : "TestCase",
"ret" : 1,
"name" : "hexDecode",
"input" : "5465737443617365",
"type" : "tfn"
},
{
"type" : "tfn",
"input" : "546573740043617365",
"name" : "hexDecode",
"ret" : 1,
"output" : "Test\\u0000Case"
},
{
"output" : "\\x01#Eg\\x89\\x0a#\\x01#Eg\\x89\\x0a",
"type" : "tfn",
"input" : "01234567890a0z01234567890a",
"name" : "hexDecode",
"ret" : 1
},
{
"type" : "tfn",
"name" : "hexDecode",
"input" : "01234567890az",
"output" : "\\x01#Eg\\x89\\x0a",
"ret" : 1
},
{
"type" : "tfn",
"name" : "hexDecode",
"input" : "01234567890a0",
"output" : "\\x01#Eg\\x89\\x0a",
"ret" : 1
}
]

View File

@ -0,0 +1,23 @@
[
{
"ret" : 1,
"input" : "",
"type" : "tfn",
"name" : "hexEncode",
"output" : ""
},
{
"output" : "5465737443617365",
"ret" : 1,
"name" : "hexEncode",
"input" : "TestCase",
"type" : "tfn"
},
{
"output" : "546573740043617365",
"name" : "hexEncode",
"input" : "Test\\u0000Case",
"type" : "tfn",
"ret" : 1
}
]

View File

@ -0,0 +1,51 @@
[
{
"name" : "htmlEntityDecode",
"input" : "",
"type" : "tfn",
"ret" : 0,
"output" : ""
},
{
"output" : "TestCase",
"ret" : 0,
"input" : "TestCase",
"type" : "tfn",
"name" : "htmlEntityDecode"
},
{
"ret" : 0,
"type" : "tfn",
"input" : "Test\\u0000Case",
"name" : "htmlEntityDecode",
"output" : "Test\\u0000Case"
},
{
"output" : "&#xg;&#Xg;&#xg0;\\u0002g;&#a;\\u0000&#a2;\\u0003a&#a00;\\u0001a0;\na;&foo;",
"ret" : 1,
"input" : "&#xg;&#Xg;&#xg0;&#X2g;&#a;\\u0000&#a2;&#3a&#a00;&#1a0;&#10a;&foo;",
"type" : "tfn",
"name" : "htmlEntityDecode"
},
{
"ret" : 1,
"name" : "htmlEntityDecode",
"input" : "&#xg&#Xg&#xg0&#X2g&#a\\u0000&#a2&#3a&#a00&#1a0&#10a&foo",
"type" : "tfn",
"output" : "&#xg&#Xg&#xg0\\u0002g&#a\\u0000&#a2\\u0003a&#a00\\u0001a0\na&foo"
},
{
"output" : "\\x00\\x00\\x20\\x20\\x00\\x20\\x00\\x64\"&<>\\xa0",
"type" : "tfn",
"input" : "&#x0&#X0&#x20&#X20&#0&#32\\u0000&#100&quot&amp&lt&gt&nbsp",
"name" : "htmlEntityDecode",
"ret" : 1
},
{
"output" : "\\x00\\x00\\x20\\x20\\x00\\x20\\x00\\x64\"&<>\\xa0",
"ret" : 1,
"name" : "htmlEntityDecode",
"input" : "&#x0;&#X0;&#x20;&#X20;&#0;&#32;\\x00&#100;&quot;&amp;&lt;&gt;&nbsp;",
"type" : "tfn"
}
]

View File

@ -0,0 +1,107 @@
[
{
"output" : "",
"ret" : 0,
"input" : "",
"name" : "jsDecode",
"type" : "tfn"
},
{
"output" : "TestCase",
"ret" : 0,
"type" : "tfn",
"input" : "TestCase",
"name" : "jsDecode"
},
{
"ret" : 0,
"input" : "Test\u0000Case",
"type" : "tfn",
"name" : "jsDecode",
"output" : "Test\u0000Case"
},
{
"input" : "\\\\a\\\\b\\\\f\\\\n\\\\r\\\\t\\\\v\\?\\'\\\"\\0\\12\\123\\x00\\xff",
"output" : "\\a\\b\\f\\n\\r\\t\\v?'\"\\x00\\x0a\\x53\\x00\\xff",
"ret" : 1,
"type" : "tfn",
"name" : "jsDecode"
},
{
"output" : "8966\\x0a\\x00\\x00\\x00\\x0a\\x0a\\x0a3u00a",
"input" : "8966\\x0a\\x00\\x00\\x00\\x0a\\x0a\\x0a3u00a",
"type" : "tfn",
"name" : "jsDecode",
"ret" : 1
},
{
"input" : "\\x",
"name" : "jsDecode",
"type" : "tfn",
"ret" : 1,
"output" : "x"
},
{
"output" : "xx0",
"ret" : 1,
"name" : "jsDecode",
"input" : "\\x\\x0",
"type" : "tfn"
},
{
"output" : "xx0\u0000",
"type" : "tfn",
"input" : "\\x\\x0\u0000",
"name" : "jsDecode",
"ret" : 1
},
{
"output" : "u",
"input" : "\\u",
"name" : "jsDecode",
"type" : "tfn",
"ret" : 1
},
{
"input" : "\\u\\u0",
"name" : "jsDecode",
"type" : "tfn",
"ret" : 1,
"output" : "uu0"
},
{
"ret" : 1,
"type" : "tfn",
"input" : "\\u\\u0\\u01",
"name" : "jsDecode",
"output" : "uu0u01"
},
{
"input" : "\\u\\u0\\u01\\u012",
"type" : "tfn",
"name" : "jsDecode",
"ret" : 1,
"output" : "uu0u01u012"
},
{
"ret" : 1,
"input" : "\\u\\u0\\u01\\u012\u0000",
"type" : "tfn",
"name" : "jsDecode",
"output" : "uu0u01u012\u0000"
},
{
"input" : "\\",
"type" : "tfn",
"name" : "jsDecode",
"ret" : 0,
"output" : "\\"
},
{
"output" : "\\0",
"ret" : 1,
"input" : "\\\\0",
"type" : "tfn",
"name" : "jsDecode"
}
]

View File

@ -0,0 +1,30 @@
[
{
"output" : "0",
"input" : "",
"type" : "tfn",
"name" : "length",
"ret" : 1
},
{
"output" : "16",
"ret" : 1,
"input" : "0123456789abcdef",
"type" : "tfn",
"name" : "length"
},
{
"ret" : 1,
"input" : "0123456789\tabcdef",
"name" : "length",
"type" : "tfn",
"output" : "17"
},
{
"output" : "9",
"input" : "Test\\u0000Case",
"type" : "tfn",
"name" : "length",
"ret" : 1
}
]

View File

@ -0,0 +1,37 @@
[
{
"input" : "",
"name" : "lowercase",
"type" : "tfn",
"ret" : 0,
"output" : ""
},
{
"output" : "testcase",
"ret" : 0,
"name" : "lowercase",
"input" : "testcase",
"type" : "tfn"
},
{
"ret" : 0,
"input" : "test\u0000case",
"type" : "tfn",
"name" : "lowercase",
"output" : "test\u0000case"
},
{
"output" : "testcase",
"input" : "TestCase",
"name" : "lowercase",
"type" : "tfn",
"ret" : 1
},
{
"ret" : 1,
"input" : "Test\u0000Case",
"name" : "lowercase",
"type" : "tfn",
"output" : "test\u0000case"
}
]

View File

@ -0,0 +1,37 @@
[
{
"output" : "-Se\\x90)-B~N\\x14\\x82\\x9aE\\xbc\\xfe\\x89",
"ret" : 1,
"input" : "zimmerle",
"type" : "tfn",
"name" : "md5"
},
{
"output" : "\\xd4\\x1d\\x8c\\xd9\\x8f\\x00\\xb2\\x04\\xe9\\x80\\x09\\x98\\xec\\xf8B~",
"ret" : 1,
"input" : "",
"type" : "tfn",
"name" : "md5"
},
{
"output" : "\\xc16\\x83Y\\xaa)(\\xa50\\xb5\\x00\\x07\\xd1\\xde\\xeaw",
"ret" : 1,
"input" : "진 마 리",
"name" : "md5",
"type" : "tfn"
},
{
"output" : "\\xa6\\xe7\\xd3\\xb4o\\xdf\\xaf\\x0b\\xde*\\x1f\\x83*\\x00\\xd2\\xde",
"ret" : 1,
"input" : "\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08",
"name" : "md5",
"type" : "tfn"
},
{
"input" : "TestCase",
"type" : "tfn",
"name" : "md5",
"ret" : 1,
"output" : "\\xc9\\xab\\xa2\\xc3\\xe6\\x01&\\x16\\x9e\\x80\\xe9\\xa2k\\xa2s\\xc1"
}
]

View File

@ -0,0 +1,219 @@
[
{
"ret" : 0,
"input" : "",
"name" : "normalisePath",
"type" : "tfn",
"output" : ""
},
{
"name" : "normalisePath",
"input" : "/foo/bar/baz",
"type" : "tfn",
"ret" : 0,
"output" : "/foo/bar/baz"
},
{
"ret" : 0,
"input" : "/foo/bar\\u0000/baz",
"name" : "normalisePath",
"type" : "tfn",
"output" : "/foo/bar\\u0000/baz"
},
{
"name" : "normalisePath",
"input" : "x",
"type" : "tfn",
"ret" : 0,
"output" : "x"
},
{
"output" : "",
"name" : "normalisePath",
"input" : ".",
"type" : "tfn",
"ret" : 1
},
{
"output" : "",
"ret" : 1,
"type" : "tfn",
"input" : "./",
"name" : "normalisePath"
},
{
"ret" : 1,
"input" : "./..",
"name" : "normalisePath",
"type" : "tfn",
"output" : ".."
},
{
"ret" : 1,
"input" : "./../",
"name" : "normalisePath",
"type" : "tfn",
"output" : "../"
},
{
"output" : "..",
"ret" : 0,
"input" : "..",
"name" : "normalisePath",
"type" : "tfn"
},
{
"output" : "../",
"ret" : 0,
"input" : "../",
"name" : "normalisePath",
"type" : "tfn"
},
{
"output" : "..",
"input" : "../.",
"name" : "normalisePath",
"type" : "tfn",
"ret" : 1
},
{
"name" : "normalisePath",
"input" : ".././",
"type" : "tfn",
"ret" : 1,
"output" : "../"
},
{
"ret" : 0,
"input" : "../..",
"name" : "normalisePath",
"type" : "tfn",
"output" : "../.."
},
{
"ret" : 0,
"type" : "tfn",
"input" : "../../",
"name" : "normalisePath",
"output" : "../../"
},
{
"name" : "normalisePath",
"input" : "/dir/foo//bar",
"type" : "tfn",
"ret" : 1,
"output" : "/dir/foo/bar"
},
{
"input" : "dir/foo//bar/",
"type" : "tfn",
"name" : "normalisePath",
"ret" : 1,
"output" : "dir/foo/bar/"
},
{
"output" : "foo",
"ret" : 1,
"input" : "dir/../foo",
"type" : "tfn",
"name" : "normalisePath"
},
{
"output" : "../foo",
"type" : "tfn",
"input" : "dir/../../foo",
"name" : "normalisePath",
"ret" : 1
},
{
"ret" : 1,
"input" : "dir/./.././../../foo/bar",
"name" : "normalisePath",
"type" : "tfn",
"output" : "../../foo/bar"
},
{
"output" : "../../foo/bar",
"type" : "tfn",
"input" : "dir/./.././../../foo/bar/.",
"name" : "normalisePath",
"ret" : 1
},
{
"output" : "../../foo/bar/",
"ret" : 1,
"input" : "dir/./.././../../foo/bar/./",
"name" : "normalisePath",
"type" : "tfn"
},
{
"input" : "dir/./.././../../foo/bar/..",
"name" : "normalisePath",
"type" : "tfn",
"ret" : 1,
"output" : "../../foo"
},
{
"output" : "../../foo/",
"ret" : 1,
"input" : "dir/./.././../../foo/bar/../",
"name" : "normalisePath",
"type" : "tfn"
},
{
"ret" : 1,
"name" : "normalisePath",
"input" : "dir/./.././../../foo/bar/",
"type" : "tfn",
"output" : "../../foo/bar/"
},
{
"output" : "../../foo/bar",
"name" : "normalisePath",
"input" : "dir//.//..//.//..//..//foo//bar",
"type" : "tfn",
"ret" : 1
},
{
"name" : "normalisePath",
"input" : "dir//.//..//.//..//..//foo//bar//",
"type" : "tfn",
"ret" : 1,
"output" : "../../foo/bar/"
},
{
"output" : "dir",
"ret" : 1,
"input" : "dir/subdir/subsubdir/subsubsubdir/../../..",
"name" : "normalisePath",
"type" : "tfn"
},
{
"ret" : 1,
"type" : "tfn",
"input" : "dir/./subdir/./subsubdir/./subsubsubdir/../../..",
"name" : "normalisePath",
"output" : "dir"
},
{
"ret" : 1,
"input" : "dir/./subdir/../subsubdir/../subsubsubdir/..",
"type" : "tfn",
"name" : "normalisePath",
"output" : "dir"
},
{
"type" : "tfn",
"input" : "/dir/./subdir/../subsubdir/../subsubsubdir/../",
"name" : "normalisePath",
"ret" : 1,
"output" : "/dir/"
},
{
"output" : "/etc/passwd",
"ret" : 1,
"type" : "tfn",
"input" : "/./.././../../../../../../../\\u0000/../etc/./passwd",
"name" : "normalisePath"
}
]

View File

@ -0,0 +1,219 @@
[
{
"output" : "",
"input" : "",
"name" : "normalisePathWin",
"type" : "tfn",
"ret" : 0
},
{
"output" : "/foo/bar/baz",
"ret" : 1,
"name" : "normalisePathWin",
"input" : "\\foo\\bar\\baz",
"type" : "tfn"
},
{
"type" : "tfn",
"input" : "\\foo\\bar\\u0000\\baz",
"name" : "normalisePathWin",
"ret" : 1,
"output" : "/foo/bar\\u0000/baz"
},
{
"output" : "x",
"name" : "normalisePathWin",
"input" : "x",
"type" : "tfn",
"ret" : 0
},
{
"ret" : 1,
"type" : "tfn",
"input" : ".",
"name" : "normalisePathWin",
"output" : ""
},
{
"output" : "",
"input" : ".\\",
"type" : "tfn",
"name" : "normalisePathWin",
"ret" : 1
},
{
"type" : "tfn",
"input" : ".\\..",
"name" : "normalisePathWin",
"ret" : 1,
"output" : ".."
},
{
"name" : "normalisePathWin",
"input" : ".\\..\\",
"type" : "tfn",
"ret" : 1,
"output" : "../"
},
{
"type" : "tfn",
"input" : "..",
"name" : "normalisePathWin",
"ret" : 0,
"output" : ".."
},
{
"ret" : 1,
"input" : "..\\",
"name" : "normalisePathWin",
"type" : "tfn",
"output" : "../"
},
{
"name" : "normalisePathWin",
"input" : "..\\.",
"type" : "tfn",
"ret" : 1,
"output" : ".."
},
{
"input" : "..\\.\\",
"type" : "tfn",
"name" : "normalisePathWin",
"ret" : 1,
"output" : "../"
},
{
"output" : "../..",
"input" : "..\\..",
"type" : "tfn",
"name" : "normalisePathWin",
"ret" : 1
},
{
"ret" : 1,
"input" : "..\\..\\",
"name" : "normalisePathWin",
"type" : "tfn",
"output" : "../../"
},
{
"ret" : 1,
"name" : "normalisePathWin",
"input" : "\\dir\\foo\\\\bar",
"type" : "tfn",
"output" : "/dir/foo/bar"
},
{
"output" : "dir/foo/bar/",
"ret" : 1,
"type" : "tfn",
"input" : "dir\\foo\\\\bar\\",
"name" : "normalisePathWin"
},
{
"output" : "foo",
"input" : "dir\\..\\foo",
"name" : "normalisePathWin",
"type" : "tfn",
"ret" : 1
},
{
"type" : "tfn",
"input" : "dir\\..\\..\\foo",
"name" : "normalisePathWin",
"ret" : 1,
"output" : "../foo"
},
{
"ret" : 1,
"type" : "tfn",
"input" : "dir\\.\\..\\.\\..\\..\\foo\\bar",
"name" : "normalisePathWin",
"output" : "../../foo/bar"
},
{
"output" : "../../foo/bar",
"input" : "dir\\.\\..\\.\\..\\..\\foo\\bar\\.",
"type" : "tfn",
"name" : "normalisePathWin",
"ret" : 1
},
{
"input" : "dir\\.\\..\\.\\..\\..\\foo\\bar\\.\\",
"type" : "tfn",
"name" : "normalisePathWin",
"ret" : 1,
"output" : "../../foo/bar/"
},
{
"input" : "dir\\.\\..\\.\\..\\..\\foo\\bar\\..",
"name" : "normalisePathWin",
"type" : "tfn",
"ret" : 1,
"output" : "../../foo"
},
{
"ret" : 1,
"name" : "normalisePathWin",
"input" : "dir\\.\\..\\.\\..\\..\\foo\\bar\\..\\",
"type" : "tfn",
"output" : "../../foo/"
},
{
"output" : "../../foo/bar/",
"input" : "dir\\.\\..\\.\\..\\..\\foo\\bar\\",
"name" : "normalisePathWin",
"type" : "tfn",
"ret" : 1
},
{
"output" : "../../foo/bar",
"input" : "dir\\\\.\\\\..\\\\.\\\\..\\\\..\\\\foo\\\\bar",
"name" : "normalisePathWin",
"type" : "tfn",
"ret" : 1
},
{
"output" : "../../foo/bar/",
"name" : "normalisePathWin",
"input" : "dir\\\\.\\\\..\\\\.\\\\..\\\\..\\\\foo\\\\bar\\\\",
"type" : "tfn",
"ret" : 1
},
{
"input" : "dir\\subdir\\subsubdir\\subsubsubdir\\..\\..\\..",
"type" : "tfn",
"name" : "normalisePathWin",
"ret" : 1,
"output" : "dir"
},
{
"ret" : 1,
"type" : "tfn",
"input" : "dir\\.\\subdir\\.\\subsubdir\\.\\subsubsubdir\\..\\..\\..",
"name" : "normalisePathWin",
"output" : "dir"
},
{
"input" : "dir\\.\\subdir\\..\\subsubdir\\..\\subsubsubdir\\..",
"name" : "normalisePathWin",
"type" : "tfn",
"ret" : 1,
"output" : "dir"
},
{
"output" : "/dir/",
"ret" : 1,
"input" : "\\dir\\.\\subdir\\..\\subsubdir\\..\\subsubsubdir\\..\\",
"type" : "tfn",
"name" : "normalisePathWin"
},
{
"output" : "/etc/passwd",
"ret" : 1,
"input" : "\\.\\..\\.\\..\\..\\..\\..\\..\\..\\..\\\\0\\..\\etc\\.\\passwd",
"name" : "normalisePathWin",
"type" : "tfn"
}
]

View File

@ -0,0 +1,30 @@
[
{
"name" : "parityEven7bit",
"input" : "",
"type" : "tfn",
"ret" : 0,
"output" : ""
},
{
"output" : "cefijloqrtwx03569ABDGHKMNPSUVYZ",
"ret" : 0,
"name" : "parityEven7bit",
"input" : "cefijloqrtwx03569ABDGHKMNPSUVYZ",
"type" : "tfn"
},
{
"output" : "\\xe1\\xe2c\\xe4ef\\xe7\\xe8ij\\xebl\\xed\\xeeo\\xf0qr\\xf3t\\xf5\\xf6wx\\xf9\\xfa0\\xb1\\xb23\\xb456\\xb7\\xb89AB\\xc3D\\xc5\\xc6GH\\xc9\\xcaK\\xccMN\\xcfP\\xd1\\xd2S\\xd4UV\\xd7\\xd8YZ",
"name" : "parityEven7bit",
"input" : "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"type" : "tfn",
"ret" : 1
},
{
"output" : "\\xe1\\xe2c\\xe4ef\\xe7\\xe8ij\\xebl\\xed\\xeeo\\xf0qr\\xf3t\\xf5\\xf6wx\\xf9\\xfa\\x000\\xb1\\xb23\\xb456\\xb7\\xb89\\x00AB\\xc3D\\xc5\\xc6GH\\xc9\\xcaK\\xccMN\\xcfP\\xd1\\xd2S\\xd4UV\\xd7\\xd8YZ",
"input" : "abcdefghijklmnopqrstuvwxyz\\u00000123456789\\u0000ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"type" : "tfn",
"name" : "parityEven7bit",
"ret" : 1
}
]

View File

@ -0,0 +1,30 @@
[
{
"output" : "",
"ret" : 0,
"input" : "",
"type" : "tfn",
"name" : "parityOdd7bit"
},
{
"output" : "abdghkmnpsuvyz12478CEFIJLOQRTW",
"ret" : 0,
"input" : "abdghkmnpsuvyz12478CEFIJLOQRTW",
"type" : "tfn",
"name" : "parityOdd7bit"
},
{
"output" : "ab\\xe3d\\xe5\\xe6gh\\xe9\\xeak\\xecmn\\xefp\\xf1\\xf2s\\xf4uv\\xf7\\xf8yz\\xb012\\xb34\\xb5\\xb678\\xb9\\xc1\\xc2C\\xc4EF\\xc7\\xc8IJ\\xcbL\\xcd\\xceO\\xd0QR\\xd3T\\xd5\\xd6WX\\xd9\\xda",
"ret" : 1,
"type" : "tfn",
"input" : "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"name" : "parityOdd7bit"
},
{
"output" : "ab\\xe3d\\xe5\\xe6gh\\xe9\\xeak\\xecmn\\xefp\\xf1\\xf2s\\xf4uv\\xf7\\xf8yz\\x80\\xb012\\xb34\\xb5\\xb678\\xb9\\x80\\xc1\\xc2C\\xc4EF\\xc7\\xc8IJ\\xcbL\\xcd\\xceO\\xd0QR\\xd3T\\xd5\\xd6WX\\xd9\\xda",
"name" : "parityOdd7bit",
"input" : "abcdefghijklmnopqrstuvwxyz\\u00000123456789\\u0000ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"type" : "tfn",
"ret" : 1
}
]

View File

@ -0,0 +1,30 @@
[
{
"output" : "",
"ret" : 0,
"input" : "",
"type" : "tfn",
"name" : "parityZero7bit"
},
{
"output" : "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"ret" : 0,
"input" : "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"name" : "parityZero7bit",
"type" : "tfn"
},
{
"output" : "abcdefghijklmnopqrstuvwxyz\\u00000123456789\\u0000ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"ret" : 0,
"input" : "abcdefghijklmnopqrstuvwxyz\\u00000123456789\\u0000ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"type" : "tfn",
"name" : "parityZero7bit"
},
{
"output" : "B\\x00\\x00B\\x0fC?",
"ret" : 1,
"input" : "€\\u0000ÿ",
"type" : "tfn",
"name" : "parityZero7bit"
}
]

View File

@ -0,0 +1,93 @@
[
{
"input" : "abc",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 0,
"output" : "abc"
},
{
"input" : "a_bc",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 0,
"output" : "a_bc"
},
{
"input" : "a_b.c",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "a_b_c"
},
{
"input" : "a[_b c.",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "a__b c."
},
{
"input" : ". a_b]c",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "__a_b]c"
},
{
"input" : "a_b c d_",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "a_b_c_d_"
},
{
"input" : "[a_[b][]c d_",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : ""
},
{
"input" : "a_[b][ ]c d_",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "a_[b][]"
},
{
"input" : "][ ",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "]_ "
},
{
"input" : "][ a.",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "]_ a."
},
{
"input" : " ] [a][c][f. _ ]",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "]_[a][c][f. _ ]"
},
{
"input" : "a[]b",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "a[]"
},
{
"input" : "sc ript._[a[_xss]",
"name" : "phpArgsNames",
"type" : "tfn",
"ret" : 1,
"output" : "sc_ript__[a[_xss]"
}
]

View File

@ -0,0 +1,149 @@
[
{
"output" : "",
"input" : "",
"type" : "tfn",
"name" : "removeComments",
"ret" : 1
},
{
"input" : "TestCase",
"type" : "tfn",
"name" : "removeComments",
"ret" : 1,
"output" : "TestCase"
},
{
"ret" : 1,
"input" : "Test\\u0000Case",
"name" : "removeComments",
"type" : "tfn",
"output" : "Test\\u0000Case"
},
{
"ret" : 1,
"input" : "/* TestCase */",
"name" : "removeComments",
"type" : "tfn",
"output" : "\\x00"
},
{
"output" : "\\x00",
"ret" : 1,
"type" : "tfn",
"input" : "/*TestCase*/",
"name" : "removeComments"
},
{
"input" : "/* TestCase*/",
"type" : "tfn",
"name" : "removeComments",
"ret" : 1,
"output" : "\\x00"
},
{
"output" : "\\x00",
"ret" : 1,
"name" : "removeComments",
"input" : "/*TestCase */",
"type" : "tfn"
},
{
"output" : "BeforeAfter",
"ret" : 1,
"type" : "tfn",
"input" : "Before/* TestCase */After",
"name" : "removeComments"
},
{
"output" : "Before TestCase */ After",
"name" : "removeComments",
"input" : "Before TestCase */ After",
"type" : "tfn",
"ret" : 1
},
{
"type" : "tfn",
"input" : "/* Test\\nCase */",
"name" : "removeComments",
"ret" : 1,
"output" : "\\x00"
},
{
"name" : "removeComments",
"input" : "/* Test\r\nCase */",
"type" : "tfn",
"ret" : 1,
"output" : "\\x00"
},
{
"ret" : 1,
"input" : "/* Test\nCase */",
"type" : "tfn",
"name" : "removeComments",
"output" : "\\x00"
},
{
"ret" : 1,
"name" : "removeComments",
"input" : "/* Test\rCase */",
"type" : "tfn",
"output" : "\\x00"
},
{
"ret" : 1,
"input" : "/*Before/* Test\r\nCase ",
"type" : "tfn",
"name" : "removeComments",
"output" : " "
},
{
"output" : "Before ",
"input" : "Before /* Test\nCase ",
"type" : "tfn",
"name" : "removeComments",
"ret" : 1
},
{
"output" : "Before \r\nCase ",
"ret" : 1,
"input" : "Before/* T*/ /* e */ /* s */ /* t */\r\nCase ",
"name" : "removeComments",
"type" : "tfn"
},
{
"input" : "Before /* */ ops */ Test\nCase ",
"name" : "removeComments",
"type" : "tfn",
"ret" : 1,
"output" : "Before ops */ Test\nCase "
},
{
"ret" : 1,
"name" : "removeComments",
"input" : "/*Test\r\nCase */After",
"type" : "tfn",
"output" : "After"
},
{
"output" : "Test\nCase After",
"name" : "removeComments",
"input" : "Test\nCase /**/ After",
"type" : "tfn",
"ret" : 1
},
{
"output" : "Test\r\nCase */After",
"ret" : 1,
"name" : "removeComments",
"input" : "Test\r\nCase */After",
"type" : "tfn"
},
{
"input" : "Test/*\nCase */ After",
"name" : "removeComments",
"type" : "tfn",
"ret" : 1,
"output" : "Test After"
}
]

View File

@ -0,0 +1,149 @@
[
{
"output" : "",
"input" : "",
"type" : "tfn",
"name" : "removeCommentsChar",
"ret" : 1
},
{
"input" : "TestCase",
"type" : "tfn",
"name" : "removeCommentsChar",
"ret" : 1,
"output" : "TestCase"
},
{
"ret" : 1,
"input" : "Test\\u0000Case",
"name" : "removeCommentsChar",
"type" : "tfn",
"output" : "Test\\u0000Case"
},
{
"ret" : 1,
"input" : "/* TestCase */",
"name" : "removeCommentsChar",
"type" : "tfn",
"output" : " TestCase "
},
{
"output" : "TestCase",
"ret" : 1,
"type" : "tfn",
"input" : "/*TestCase*/",
"name" : "removeCommentsChar"
},
{
"input" : "/* TestCase*/",
"type" : "tfn",
"name" : "removeCommentsChar",
"ret" : 1,
"output" : " TestCase"
},
{
"output" : "TestCase ",
"ret" : 1,
"name" : "removeCommentsChar",
"input" : "/*TestCase */",
"type" : "tfn"
},
{
"output" : "Before TestCase After",
"ret" : 1,
"type" : "tfn",
"input" : "Before/* TestCase */After",
"name" : "removeCommentsChar"
},
{
"output" : "Before TestCase After",
"name" : "removeCommentsChar",
"input" : "Before /* TestCase */ After",
"type" : "tfn",
"ret" : 1
},
{
"type" : "tfn",
"input" : "/* Test\\nCase */",
"name" : "removeCommentsChar",
"ret" : 1,
"output" : " Test\\nCase "
},
{
"name" : "removeCommentsChar",
"input" : "/* Test\r\nCase */",
"type" : "tfn",
"ret" : 1,
"output" : " Test\r\nCase "
},
{
"ret" : 1,
"input" : "/* Test\nCase */",
"type" : "tfn",
"name" : "removeCommentsChar",
"output" : " Test\nCase "
},
{
"ret" : 1,
"name" : "removeCommentsChar",
"input" : "/* Test\rCase */",
"type" : "tfn",
"output" : " Test\rCase "
},
{
"ret" : 1,
"input" : "Before/* Test\r\nCase ",
"type" : "tfn",
"name" : "removeCommentsChar",
"output" : "Before Test\r\nCase "
},
{
"output" : "Before Test\nCase ",
"input" : "Before /* Test\nCase ",
"type" : "tfn",
"name" : "removeCommentsChar",
"ret" : 1
},
{
"output" : "Before Test\r\nCase ",
"ret" : 1,
"input" : "Before/* Test\r\nCase ",
"name" : "removeCommentsChar",
"type" : "tfn"
},
{
"input" : "Before /* Test\nCase ",
"name" : "removeCommentsChar",
"type" : "tfn",
"ret" : 1,
"output" : "Before Test\nCase "
},
{
"ret" : 1,
"name" : "removeCommentsChar",
"input" : "Test\r\nCase */After",
"type" : "tfn",
"output" : "Test\r\nCase After"
},
{
"output" : "Test\nCase After",
"name" : "removeCommentsChar",
"input" : "Test\nCase */ After",
"type" : "tfn",
"ret" : 1
},
{
"output" : "Test\r\nCase After",
"ret" : 1,
"name" : "removeCommentsChar",
"input" : "Test\r\nCase */After",
"type" : "tfn"
},
{
"input" : "Test\nCase */ After",
"name" : "removeCommentsChar",
"type" : "tfn",
"ret" : 1,
"output" : "Test\nCase After"
}
]

View File

@ -0,0 +1,58 @@
[
{
"input" : "",
"type" : "tfn",
"name" : "removeNulls",
"ret" : 0,
"output" : ""
},
{
"ret" : 0,
"input" : "TestCase",
"type" : "tfn",
"name" : "removeNulls",
"output" : "TestCase"
},
{
"output" : "Test\\u0001Case",
"input" : "Test\\u0001Case",
"type" : "tfn",
"name" : "removeNulls",
"ret" : 0
},
{
"input" : "\\x00TestCase",
"type" : "tfn",
"name" : "removeNulls",
"ret" : 1,
"output" : "TestCase"
},
{
"output" : "TestCase",
"ret" : 1,
"input" : "Test\\x00Case",
"name" : "removeNulls",
"type" : "tfn"
},
{
"input" : "Test\\x00\\x00Case",
"type" : "tfn",
"name" : "removeNulls",
"ret" : 1,
"output" : "TestCase"
},
{
"output" : "TestCase",
"ret" : 1,
"input" : "TestCase\\x00",
"name" : "removeNulls",
"type" : "tfn"
},
{
"output" : "TestCase",
"type" : "tfn",
"input" : "\\x00Test\\x00Case\\x00",
"name" : "removeNulls",
"ret" : 1
}
]

View File

@ -0,0 +1,37 @@
[
{
"output" : "",
"input" : "",
"type" : "tfn",
"name" : "removeWhitespace",
"ret" : 0
},
{
"output" : "TestCase",
"ret" : 0,
"name" : "removeWhitespace",
"input" : "TestCase",
"type" : "tfn"
},
{
"ret" : 0,
"input" : "Test\u0000Case",
"name" : "removeWhitespace",
"type" : "tfn",
"output" : "Test\u0000Case"
},
{
"output" : "TestCase",
"name" : "removeWhitespace",
"input" : " Test \t Case ",
"type" : "tfn",
"ret" : 1
},
{
"input" : "This is a test case with a tab \t, vtab \u000b, newline \n, return \r, formfeed \f, and a NUL\u0000 in it with a CRLF at the end.\r\n",
"type" : "tfn",
"name" : "removeWhitespace",
"ret" : 1,
"output" : "Thisisatestcasewithatab,vtab,newline,return,formfeed,andaNUL\u0000initwithaCRLFattheend."
}
]

View File

@ -0,0 +1,149 @@
[
{
"output" : "",
"input" : "",
"type" : "tfn",
"name" : "replaceComments",
"ret" : 0
},
{
"input" : "TestCase",
"type" : "tfn",
"name" : "replaceComments",
"ret" : 0,
"output" : "TestCase"
},
{
"ret" : 0,
"input" : "Test\\u0000Case",
"name" : "replaceComments",
"type" : "tfn",
"output" : "Test\\u0000Case"
},
{
"ret" : 1,
"input" : "/* TestCase */",
"name" : "replaceComments",
"type" : "tfn",
"output" : " "
},
{
"output" : " ",
"ret" : 1,
"type" : "tfn",
"input" : "/*TestCase*/",
"name" : "replaceComments"
},
{
"input" : "/* TestCase*/",
"type" : "tfn",
"name" : "replaceComments",
"ret" : 1,
"output" : " "
},
{
"output" : " ",
"ret" : 1,
"name" : "replaceComments",
"input" : "/*TestCase */",
"type" : "tfn"
},
{
"output" : "Before After",
"ret" : 1,
"type" : "tfn",
"input" : "Before/* TestCase */After",
"name" : "replaceComments"
},
{
"output" : "Before After",
"name" : "replaceComments",
"input" : "Before /* TestCase */ After",
"type" : "tfn",
"ret" : 1
},
{
"type" : "tfn",
"input" : "/* Test\\nCase */",
"name" : "replaceComments",
"ret" : 1,
"output" : " "
},
{
"name" : "replaceComments",
"input" : "/* Test\r\nCase */",
"type" : "tfn",
"ret" : 1,
"output" : " "
},
{
"ret" : 1,
"input" : "/* Test\nCase */",
"type" : "tfn",
"name" : "replaceComments",
"output" : " "
},
{
"ret" : 1,
"name" : "replaceComments",
"input" : "/* Test\rCase */",
"type" : "tfn",
"output" : " "
},
{
"ret" : 1,
"input" : "Before/* Test\r\nCase ",
"type" : "tfn",
"name" : "replaceComments",
"output" : "Before "
},
{
"output" : "Before ",
"input" : "Before /* Test\nCase ",
"type" : "tfn",
"name" : "replaceComments",
"ret" : 1
},
{
"output" : "Before ",
"ret" : 1,
"input" : "Before/* Test\r\nCase ",
"name" : "replaceComments",
"type" : "tfn"
},
{
"input" : "Before /* Test\nCase ",
"name" : "replaceComments",
"type" : "tfn",
"ret" : 1,
"output" : "Before "
},
{
"ret" : 0,
"name" : "replaceComments",
"input" : "Test\r\nCase */After",
"type" : "tfn",
"output" : "Test\r\nCase */After"
},
{
"output" : "Test\nCase */ After",
"name" : "replaceComments",
"input" : "Test\nCase */ After",
"type" : "tfn",
"ret" : 0
},
{
"output" : "Test\r\nCase */After",
"ret" : 0,
"name" : "replaceComments",
"input" : "Test\r\nCase */After",
"type" : "tfn"
},
{
"input" : "Test\nCase */ After",
"name" : "replaceComments",
"type" : "tfn",
"ret" : 0,
"output" : "Test\nCase */ After"
}
]

View File

@ -0,0 +1,51 @@
[
{
"output" : "",
"name" : "replaceNulls",
"input" : "",
"type" : "tfn",
"ret" : 0
},
{
"input" : "TestCase",
"name" : "replaceNulls",
"type" : "tfn",
"ret" : 0,
"output" : "TestCase"
},
{
"output" : " TestCase",
"name" : "replaceNulls",
"input" : "\\u0000TestCase",
"type" : "tfn",
"ret" : 1
},
{
"output" : "Test Case",
"ret" : 1,
"input" : "Test\\u0000Case",
"name" : "replaceNulls",
"type" : "tfn"
},
{
"input" : "Test\\u0000\\u0000Case",
"type" : "tfn",
"name" : "replaceNulls",
"ret" : 1,
"output" : "Test Case"
},
{
"ret" : 1,
"name" : "replaceNulls",
"input" : "TestCase\\u0000",
"type" : "tfn",
"output" : "TestCase "
},
{
"output" : " Test Case ",
"name" : "replaceNulls",
"input" : "\\u0000Test\\u0000Case\\u0000",
"type" : "tfn",
"ret" : 1
}
]

View File

@ -0,0 +1,23 @@
[
{
"type" : "tfn",
"input" : "",
"name" : "sha1",
"ret" : 1,
"output" : "\\xda\\x39\\xa3\\xee\\x5e\\x6b\\x4b\\x0d\\x32\\x55\\xbf\\xef\\x95\\x60\\x18\\x90\\xaf\\xd8\\x07\\x09"
},
{
"type" : "tfn",
"input" : "TestCase",
"name" : "sha1",
"ret" : 1,
"output" : "\\xa7\\x0c\\xe3\\x83\\x89\\xe3\\x18\\xbd\\x2b\\xe1\\x8a\\x01\\x11\\xc6\\xdc\\x76\\xbd\\x2c\\xd9\\xed"
},
{
"type" : "tfn",
"input" : "\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08",
"name" : "sha1",
"ret" : 1,
"output" : "\\x63\\xbf\\x60\\xc7\\x10\\x5a\\x07\\xa2\\xb1\\x25\\xbb\\xf8\\x9e\\x61\\xab\\xda\\xbc\\x69\\x78\\xc2"
}
]

View File

@ -0,0 +1,9 @@
[
{
"ret" : 1,
"input" : "0x414243",
"type" : "tfn",
"name" : "sqlHexDecode",
"output" : "ABC"
}
]

View File

@ -0,0 +1,65 @@
[
{
"ret" : 0,
"type" : "tfn",
"input" : "",
"name" : "trim",
"output" : ""
},
{
"input" : "TestCase",
"name" : "trim",
"type" : "tfn",
"ret" : 0,
"output" : "TestCase"
},
{
"ret" : 0,
"input" : "Test\u0000Case",
"type" : "tfn",
"name" : "trim",
"output" : "Test\u0000Case"
},
{
"output" : "TestCase",
"input" : " TestCase",
"name" : "trim",
"type" : "tfn",
"ret" : 1
},
{
"output" : "TestCase",
"ret" : 1,
"name" : "trim",
"input" : "TestCase ",
"type" : "tfn"
},
{
"output" : "TestCase",
"ret" : 1,
"name" : "trim",
"input" : " TestCase ",
"type" : "tfn"
},
{
"output" : "Test Case",
"type" : "tfn",
"input" : " Test Case ",
"name" : "trim",
"ret" : 1
},
{
"name" : "trim",
"input" : " Test \\u0000 Case ",
"type" : "tfn",
"ret" : 1,
"output" : "Test \\u0000 Case"
},
{
"input" : " \t Test \\u0000 Case \t \t \r\n ",
"name" : "trim",
"type" : "tfn",
"ret" : 1,
"output" : "Test \\u0000 Case"
}
]

View File

@ -0,0 +1,65 @@
[
{
"type" : "tfn",
"input" : "",
"name" : "trimLeft",
"ret" : 0,
"output" : ""
},
{
"input" : "TestCase",
"type" : "tfn",
"name" : "trimLeft",
"ret" : 0,
"output" : "TestCase"
},
{
"name" : "trimLeft",
"input" : "Test\u0000Case",
"type" : "tfn",
"ret" : 0,
"output" : "Test\u0000Case"
},
{
"ret" : 0,
"type" : "tfn",
"input" : "TestCase ",
"name" : "trimLeft",
"output" : "TestCase "
},
{
"ret" : 1,
"input" : " TestCase",
"name" : "trimLeft",
"type" : "tfn",
"output" : "TestCase"
},
{
"output" : "TestCase ",
"name" : "trimLeft",
"input" : " TestCase ",
"type" : "tfn",
"ret" : 1
},
{
"output" : "Test Case ",
"ret" : 1,
"input" : " Test Case ",
"type" : "tfn",
"name" : "trimLeft"
},
{
"input" : " Test \u0000 Case ",
"name" : "trimLeft",
"type" : "tfn",
"ret" : 1,
"output" : "Test \u0000 Case "
},
{
"ret" : 1,
"type" : "tfn",
"input" : " \t Test \u0000 Case \t \t \r\n ",
"name" : "trimLeft",
"output" : "Test \u0000 Case \t \t \r\n "
}
]

View File

@ -0,0 +1,65 @@
[
{
"output" : "",
"type" : "tfn",
"input" : "",
"name" : "trimRight",
"ret" : 0
},
{
"ret" : 0,
"input" : "TestCase",
"name" : "trimRight",
"type" : "tfn",
"output" : "TestCase"
},
{
"input" : "Test\\u0000Case",
"type" : "tfn",
"name" : "trimRight",
"ret" : 0,
"output" : "Test\\u0000Case"
},
{
"output" : " TestCase",
"ret" : 0,
"input" : " TestCase",
"type" : "tfn",
"name" : "trimRight"
},
{
"input" : "TestCase ",
"type" : "tfn",
"name" : "trimRight",
"ret" : 1,
"output" : "TestCase"
},
{
"output" : " TestCase",
"input" : " TestCase ",
"type" : "tfn",
"name" : "trimRight",
"ret" : 1
},
{
"output" : " Test Case",
"ret" : 1,
"name" : "trimRight",
"input" : " Test Case ",
"type" : "tfn"
},
{
"ret" : 1,
"input" : " Test \\u0000 Case ",
"name" : "trimRight",
"type" : "tfn",
"output" : " Test \\u0000 Case"
},
{
"name" : "trimRight",
"input" : " \t Test12 \\u0000 Case \t \t \r\n ",
"type" : "tfn",
"ret" : 1,
"output" : " \t Test12 \\u0000 Case"
}
]

View File

@ -0,0 +1,135 @@
[
{
"output" : "",
"type" : "tfn",
"input" : "",
"name" : "urlDecode",
"ret" : 0
},
{
"input" : "TestCase",
"name" : "urlDecode",
"type" : "tfn",
"ret" : 0,
"output" : "TestCase"
},
{
"name" : "urlDecode",
"input" : "Test\u0000Case",
"type" : "tfn",
"ret" : 0,
"output" : "Test\u0000Case"
},
{
"type" : "tfn",
"input" : "+%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%20%21%22%23%24%25%26%27%28%29%2a%2b%2c%2d%2e%2f%30%31%32%33%34%35%36%37%38%39%3a%3b%3c%3d%3e%3f%40%41%42%43%44%45%46%47%48%49%4a%4b%4c%4d%4e%4f%50%51%52%53%54%55%56%57%58%59%5a%5b%5c%5d%5e%5f%60%61%62%63%64%65%66%67%68%69%6a%6b%6c%6d%6e%6f%70%71%72%73%74%75%76%77%78%79%7a%7b%7c%7d%7e%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff",
"name" : "urlDecode",
"ret" : 1,
"output" : " \\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f \\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2a\\x2b\\x2c\\x2d\\x2e\\x2f\\x30\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x3a\\x3b\\x3c\\x3d\\x3e\\x3f\\x40\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4a\\x4b\\x4c\\x4d\\x4e\\x4f\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5a\\x5b\\x5c\\x5d\\x5e\\x5f\\x60\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6a\\x6b\\x6c\\x6d\\x6e\\x6f\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7a\\x7b\\x7c\\x7d\\x7e\\x7f\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\\x98\\x99\\x9a\\x9b\\x9c\\x9d\\x9e\\x9f\\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\\xa8\\xa9\\xaa\\xab\\xac\\xad\\xae\\xaf\\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7\\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd7\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff"
},
{
"output" : "Test Case",
"name" : "urlDecode",
"input" : "Test+Case",
"type" : "tfn",
"ret" : 1
},
{
"output" : "% ",
"ret" : 1,
"name" : "urlDecode",
"input" : "%+",
"type" : "tfn"
},
{
"ret" : 1,
"input" : "%%20",
"type" : "tfn",
"name" : "urlDecode",
"output" : "% "
},
{
"input" : "%0g%20",
"name" : "urlDecode",
"type" : "tfn",
"ret" : 1,
"output" : "%0g "
},
{
"output" : "%0 ",
"input" : "%0%20",
"type" : "tfn",
"name" : "urlDecode",
"ret" : 1
},
{
"ret" : 1,
"input" : "%g0%20",
"type" : "tfn",
"name" : "urlDecode",
"output" : "%g0 "
},
{
"output" : "%g ",
"ret" : 1,
"name" : "urlDecode",
"input" : "%g%20",
"type" : "tfn"
},
{
"output" : "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f",
"input" : "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f",
"type" : "tfn",
"name" : "urlDecode",
"ret" : 0
},
{
"output" : "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
"ret" : 0,
"name" : "urlDecode",
"input" : "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
"type" : "tfn"
},
{
"output" : "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
"type" : "tfn",
"input" : "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
"name" : "urlDecode",
"ret" : 0
},
{
"ret" : 0,
"type" : "tfn",
"input" : "%",
"name" : "urlDecode",
"output" : "%"
},
{
"output" : "%0",
"ret" : 0,
"name" : "urlDecode",
"input" : "%0",
"type" : "tfn"
},
{
"output" : "%%",
"ret" : 0,
"name" : "urlDecode",
"input" : "%%",
"type" : "tfn"
},
{
"output" : "%0g",
"ret" : 0,
"input" : "%0g",
"type" : "tfn",
"name" : "urlDecode"
},
{
"input" : "%gg",
"name" : "urlDecode",
"type" : "tfn",
"ret" : 0,
"output" : "%gg"
}
]

View File

@ -0,0 +1,226 @@
[
{
"output" : "",
"ret" : 0,
"type" : "tfn",
"input" : "",
"name" : "urlDecodeUni"
},
{
"output" : "TestCase",
"type" : "tfn",
"input" : "TestCase",
"name" : "urlDecodeUni",
"ret" : 0
},
{
"output" : "Test\\u0000Case",
"name" : "urlDecodeUni",
"input" : "Test\\u0000Case",
"type" : "tfn",
"ret" : 0
},
{
"output" : " \\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f \\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2a\\x2b\\x2c\\x2d\\x2e\\x2f\\x30\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x3a\\x3b\\x3c\\x3d\\x3e\\x3f\\x40\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4a\\x4b\\x4c\\x4d\\x4e\\x4f\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5a\\x5b\\x5c\\x5d\\x5e\\x5f\\x60\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6a\\x6b\\x6c\\x6d\\x6e\\x6f\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7a\\x7b\\x7c\\x7d\\x7e\\x7f\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\\x98\\x99\\x9a\\x9b\\x9c\\x9d\\x9e\\x9f\\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\\xa8\\xa9\\xaa\\xab\\xac\\xad\\xae\\xaf\\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7\\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd7\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff",
"name" : "urlDecodeUni",
"input" : "+%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%20%21%22%23%24%25%26%27%28%29%2a%2b%2c%2d%2e%2f%30%31%32%33%34%35%36%37%38%39%3a%3b%3c%3d%3e%3f%40%41%42%43%44%45%46%47%48%49%4a%4b%4c%4d%4e%4f%50%51%52%53%54%55%56%57%58%59%5a%5b%5c%5d%5e%5f%60%61%62%63%64%65%66%67%68%69%6a%6b%6c%6d%6e%6f%70%71%72%73%74%75%76%77%78%79%7a%7b%7c%7d%7e%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff",
"type" : "tfn",
"ret" : 1
},
{
"output" : "Test Case",
"input" : "Test+Case",
"name" : "urlDecodeUni",
"type" : "tfn",
"ret" : 1
},
{
"ret" : 1,
"type" : "tfn",
"input" : "+%u0000%u0001%u0002%u0003%u0004%u0005%u0006%u0007%u0008%u0009%u000a%u000b%u000c%u000d%u000e%u000f%u0010%u0011%u0012%u0013%u0014%u0015%u0016%u0017%u0018%u0019%u001a%u001b%u001c%u001d%u001e%u001f%u0020%u0021%u0022%u0023%u0024%u0025%u0026%u0027%u0028%u0029%u002a%u002b%u002c%u002d%u002e%u002f%u0030%u0031%u0032%u0033%u0034%u0035%u0036%u0037%u0038%u0039%u003a%u003b%u003c%u003d%u003e%u003f%u0040%u0041%u0042%u0043%u0044%u0045%u0046%u0047%u0048%u0049%u004a%u004b%u004c%u004d%u004e%u004f%u0050%u0051%u0052%u0053%u0054%u0055%u0056%u0057%u0058%u0059%u005a%u005b%u005c%u005d%u005e%u005f%u0060%u0061%u0062%u0063%u0064%u0065%u0066%u0067%u0068%u0069%u006a%u006b%u006c%u006d%u006e%u006f%u0070%u0071%u0072%u0073%u0074%u0075%u0076%u0077%u0078%u0079%u007a%u007b%u007c%u007d%u007e%u007f%u0080%u0081%u0082%u0083%u0084%u0085%u0086%u0087%u0088%u0089%u008a%u008b%u008c%u008d%u008e%u008f%u0090%u0091%u0092%u0093%u0094%u0095%u0096%u0097%u0098%u0099%u009a%u009b%u009c%u009d%u009e%u009f%u00a0%u00a1%u00a2%u00a3%u00a4%u00a5%u00a6%u00a7%u00a8%u00a9%u00aa%u00ab%u00ac%u00ad%u00ae%u00af%u00b0%u00b1%u00b2%u00b3%u00b4%u00b5%u00b6%u00b7%u00b8%u00b9%u00ba%u00bb%u00bc%u00bd%u00be%u00bf%u00c0%u00c1%u00c2%u00c3%u00c4%u00c5%u00c6%u00c7%u00c8%u00c9%u00ca%u00cb%u00cc%u00cd%u00ce%u00cf%u00d0%u00d1%u00d2%u00d3%u00d4%u00d5%u00d6%u00d7%u00d8%u00d9%u00da%u00db%u00dc%u00dd%u00de%u00df%u00e0%u00e1%u00e2%u00e3%u00e4%u00e5%u00e6%u00e7%u00e8%u00e9%u00ea%u00eb%u00ec%u00ed%u00ee%u00ef%u00f0%u00f1%u00f2%u00f3%u00f4%u00f5%u00f6%u00f7%u00f8%u00f9%u00fa%u00fb%u00fc%u00fd%u00fe%u00ff",
"name" : "urlDecodeUni",
"output" : " \\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f \\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2a\\x2b\\x2c\\x2d\\x2e\\x2f\\x30\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x3a\\x3b\\x3c\\x3d\\x3e\\x3f\\x40\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4a\\x4b\\x4c\\x4d\\x4e\\x4f\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5a\\x5b\\x5c\\x5d\\x5e\\x5f\\x60\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6a\\x6b\\x6c\\x6d\\x6e\\x6f\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7a\\x7b\\x7c\\x7d\\x7e\\x7f\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\\x98\\x99\\x9a\\x9b\\x9c\\x9d\\x9e\\x9f\\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\\xa8\\xa9\\xaa\\xab\\xac\\xad\\xae\\xaf\\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7\\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd7\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff"
},
{
"output" : " \\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f \\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2a\\x2b\\x2c\\x2d\\x2e\\x2f\\x30\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x3a\\x3b\\x3c\\x3d\\x3e\\x3f\\x40\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4a\\x4b\\x4c\\x4d\\x4e\\x4f\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5a\\x5b\\x5c\\x5d\\x5e\\x5f\\x60\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6a\\x6b\\x6c\\x6d\\x6e\\x6f\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7a\\x7b\\x7c\\x7d\\x7e\\x7f\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\\x98\\x99\\x9a\\x9b\\x9c\\x9d\\x9e\\x9f\\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\\xa8\\xa9\\xaa\\xab\\xac\\xad\\xae\\xaf\\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7\\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd7\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff",
"input" : "+%u1100%u1101%u1102%u1103%u1104%u1105%u1106%u1107%u1108%u1109%u110a%u110b%u110c%u110d%u110e%u110f%u1110%u1111%u1112%u1113%u1114%u1115%u1116%u1117%u1118%u1119%u111a%u111b%u111c%u111d%u111e%u111f%u1120%u1121%u1122%u1123%u1124%u1125%u1126%u1127%u1128%u1129%u112a%u112b%u112c%u112d%u112e%u112f%u1130%u1131%u1132%u1133%u1134%u1135%u1136%u1137%u1138%u1139%u113a%u113b%u113c%u113d%u113e%u113f%u1140%u1141%u1142%u1143%u1144%u1145%u1146%u1147%u1148%u1149%u114a%u114b%u114c%u114d%u114e%u114f%u1150%u1151%u1152%u1153%u1154%u1155%u1156%u1157%u1158%u1159%u115a%u115b%u115c%u115d%u115e%u115f%u1160%u1161%u1162%u1163%u1164%u1165%u1166%u1167%u1168%u1169%u116a%u116b%u116c%u116d%u116e%u116f%u1170%u1171%u1172%u1173%u1174%u1175%u1176%u1177%u1178%u1179%u117a%u117b%u117c%u117d%u117e%u117f%u1180%u1181%u1182%u1183%u1184%u1185%u1186%u1187%u1188%u1189%u118a%u118b%u118c%u118d%u118e%u118f%u1190%u1191%u1192%u1193%u1194%u1195%u1196%u1197%u1198%u1199%u119a%u119b%u119c%u119d%u119e%u119f%u11a0%u11a1%u11a2%u11a3%u11a4%u11a5%u11a6%u11a7%u11a8%u11a9%u11aa%u11ab%u11ac%u11ad%u11ae%u11af%u11b0%u11b1%u11b2%u11b3%u11b4%u11b5%u11b6%u11b7%u11b8%u11b9%u11ba%u11bb%u11bc%u11bd%u11be%u11bf%u11c0%u11c1%u11c2%u11c3%u11c4%u11c5%u11c6%u11c7%u11c8%u11c9%u11ca%u11cb%u11cc%u11cd%u11ce%u11cf%u11d0%u11d1%u11d2%u11d3%u11d4%u11d5%u11d6%u11d7%u11d8%u11d9%u11da%u11db%u11dc%u11dd%u11de%u11df%u11e0%u11e1%u11e2%u11e3%u11e4%u11e5%u11e6%u11e7%u11e8%u11e9%u11ea%u11eb%u11ec%u11ed%u11ee%u11ef%u11f0%u11f1%u11f2%u11f3%u11f4%u11f5%u11f6%u11f7%u11f8%u11f9%u11fa%u11fb%u11fc%u11fd%u11fe%u11ff",
"type" : "tfn",
"name" : "urlDecodeUni",
"ret" : 1
},
{
"input" : "%uff01%uff02%uff03%uff04%uff05%uff06%uff07%uff08%uff09%uff0a%uff0b%uff0c%uff0d%uff0e%uff0f%uff10%uff11%uff12%uff13%uff14%uff15%uff16%uff17%uff18%uff19%uff1a%uff1b%uff1c%uff1d%uff1e%uff1f%uff20%uff21%uff22%uff23%uff24%uff25%uff26%uff27%uff28%uff29%uff2a%uff2b%uff2c%uff2d%uff2e%uff2f%uff30%uff31%uff32%uff33%uff34%uff35%uff36%uff37%uff38%uff39%uff3a%uff3b%uff3c%uff3d%uff3e%uff3f%uff40%uff41%uff42%uff43%uff44%uff45%uff46%uff47%uff48%uff49%uff4a%uff4b%uff4c%uff4d%uff4e%uff4f%uff50%uff51%uff52%uff53%uff54%uff55%uff56%uff57%uff58%uff59%uff5a%uff5b%uff5c%uff5d%uff5e",
"name" : "urlDecodeUni",
"type" : "tfn",
"ret" : 1,
"output" : "\\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2a\\x2b\\x2c\\x2d\\x2e\\x2f\\x30\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x3a\\x3b\\x3c\\x3d\\x3e\\x3f\\x40\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4a\\x4b\\x4c\\x4d\\x4e\\x4f\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5a\\x5b\\x5c\\x5d\\x5e\\x5f\\x60\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6a\\x6b\\x6c\\x6d\\x6e\\x6f\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7a\\x7b\\x7c\\x7d\\x7e"
},
{
"name" : "urlDecodeUni",
"input" : "%uff00%uff7f%uff80%uff81%uff82%uff83%uff84%uff85%uff86%uff87%uff88%uff89%uff8a%uff8b%uff8c%uff8d%uff8e%uff8f%uff90%uff91%uff92%uff93%uff94%uff95%uff96%uff97%uff98%uff99%uff9a%uff9b%uff9c%uff9d%uff9e%uff9f%uffa0%uffa1%uffa2%uffa3%uffa4%uffa5%uffa6%uffa7%uffa8%uffa9%uffaa%uffab%uffac%uffad%uffae%uffaf%uffb0%uffb1%uffb2%uffb3%uffb4%uffb5%uffb6%uffb7%uffb8%uffb9%uffba%uffbb%uffbc%uffbd%uffbe%uffbf%uffc0%uffc1%uffc2%uffc3%uffc4%uffc5%uffc6%uffc7%uffc8%uffc9%uffca%uffcb%uffcc%uffcd%uffce%uffcf%uffd0%uffd1%uffd2%uffd3%uffd4%uffd5%uffd6%uffd7%uffd8%uffd9%uffda%uffdb%uffdc%uffdd%uffde%uffdf%uffe0%uffe1%uffe2%uffe3%uffe4%uffe5%uffe6%uffe7%uffe8%uffe9%uffea%uffeb%uffec%uffed%uffee%uffef%ufff0%ufff1%ufff2%ufff3%ufff4%ufff5%ufff6%ufff7%ufff8%ufff9%ufffa%ufffb%ufffc%ufffd%ufffe%uffff",
"type" : "tfn",
"ret" : 1,
"output" : "\\x00\\x7f\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\\x98\\x99\\x9a\\x9b\\x9c\\x9d\\x9e\\x9f\\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\\xa8\\xa9\\xaa\\xab\\xac\\xad\\xae\\xaf\\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7\\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd7\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff"
},
{
"output" : "% ",
"input" : "%+",
"type" : "tfn",
"name" : "urlDecodeUni",
"ret" : 1
},
{
"output" : "% ",
"name" : "urlDecodeUni",
"input" : "%%20",
"type" : "tfn",
"ret" : 1
},
{
"output" : "%0g ",
"input" : "%0g%20",
"name" : "urlDecodeUni",
"type" : "tfn",
"ret" : 1
},
{
"output" : "%0 ",
"ret" : 1,
"input" : "%0%20",
"type" : "tfn",
"name" : "urlDecodeUni"
},
{
"output" : "%g0 ",
"ret" : 1,
"input" : "%g0%20",
"type" : "tfn",
"name" : "urlDecodeUni"
},
{
"input" : "%g%20",
"name" : "urlDecodeUni",
"type" : "tfn",
"ret" : 1,
"output" : "%g "
},
{
"output" : "% ",
"type" : "tfn",
"input" : "%%u0020",
"name" : "urlDecodeUni",
"ret" : 1
},
{
"output" : "%0g ",
"input" : "%0g%u0020",
"type" : "tfn",
"name" : "urlDecodeUni",
"ret" : 1
},
{
"type" : "tfn",
"input" : "%0%u0020",
"name" : "urlDecodeUni",
"ret" : 1,
"output" : "%0 "
},
{
"ret" : 1,
"input" : "%g0%u0020",
"type" : "tfn",
"name" : "urlDecodeUni",
"output" : "%g0 "
},
{
"output" : "%u ",
"ret" : 1,
"input" : "%u%u0020",
"type" : "tfn",
"name" : "urlDecodeUni"
},
{
"type" : "tfn",
"input" : "%u0%u0020",
"name" : "urlDecodeUni",
"ret" : 1,
"output" : "%u0 "
},
{
"output" : "%u00 ",
"input" : "%u00%u0020",
"name" : "urlDecodeUni",
"type" : "tfn",
"ret" : 1
},
{
"ret" : 1,
"name" : "urlDecodeUni",
"input" : "%u000%u0020",
"type" : "tfn",
"output" : "%u000 "
},
{
"ret" : 1,
"name" : "urlDecodeUni",
"input" : "%u000g%u0020",
"type" : "tfn",
"output" : "%u000g "
},
{
"type" : "tfn",
"input" : "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f",
"name" : "urlDecodeUni",
"ret" : 0,
"output" : "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f"
},
{
"output" : "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
"name" : "urlDecodeUni",
"input" : "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
"type" : "tfn",
"ret" : 0
},
{
"output" : "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
"input" : "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
"name" : "urlDecodeUni",
"type" : "tfn",
"ret" : 0
},
{
"ret" : 0,
"input" : "%",
"type" : "tfn",
"name" : "urlDecodeUni",
"output" : "%"
},
{
"output" : "%0",
"ret" : 0,
"input" : "%0",
"type" : "tfn",
"name" : "urlDecodeUni"
},
{
"ret" : 0,
"input" : "%%",
"name" : "urlDecodeUni",
"type" : "tfn",
"output" : "%%"
},
{
"type" : "tfn",
"input" : "%0g",
"name" : "urlDecodeUni",
"ret" : 0,
"output" : "%0g"
},
{
"input" : "%gg",
"name" : "urlDecodeUni",
"type" : "tfn",
"ret" : 0,
"output" : "%gg"
}
]

View File

@ -0,0 +1,149 @@
[
{
"name" : "urlEncode",
"input" : "",
"type" : "tfn",
"ret" : 0,
"output" : ""
},
{
"output" : "TestCase",
"type" : "tfn",
"input" : "TestCase",
"name" : "urlEncode",
"ret" : 0
},
{
"ret" : 1,
"type" : "tfn",
"input" : " \\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\b\t\n\\u000b\f\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f",
"name" : "urlEncode",
"output" : "+%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f"
},
{
"ret" : 1,
"type" : "tfn",
"input" : " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}",
"name" : "urlEncode",
"output" : "+%21%22%23%24%25%26%27%28%29*%2b%2c%2d%2e%2f0123456789%3a%3b%3c%3d%3e%3f%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5b%5c%5d%5e%5f%60abcdefghijklmnopqrstuvwxyz%7b%7c%7d"
},
{
"ret" : 1,
"type" : "tfn",
"input" : "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
"name" : "urlEncode",
"output" : "%c3%80%c3%81%c3%82%c3%83%c3%84%c3%85%c3%86%c3%87%c3%88%c3%89%c3%8a%c3%8b%c3%8c%c3%8d%c3%8e%c3%8f%c3%90%c3%91%c3%92%c3%93%c3%94%c3%95%c3%96%c3%97%c3%98%c3%99%c3%9a%c3%9b%c3%9c%c3%9d%c3%9e%c3%9f%c3%a0%c3%a1%c3%a2%c3%a3%c3%a4%c3%a5%c3%a6%c3%a7%c3%a8%c3%a9%c3%aa%c3%ab%c3%ac%c3%ad%c3%ae%c3%af%c3%b0%c3%b1%c3%b2%c3%b3%c3%b4%c3%b5%c3%b6%c3%b7%c3%b8%c3%b9%c3%ba%c3%bb%c3%bc%c3%bd%c3%be%c3%bf"
},
{
"ret" : 1,
"type" : "tfn",
"input" : " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿",
"name" : "urlEncode",
"output" : "%c2%a0%c2%a1%c2%a2%c2%a3%c2%a4%c2%a5%c2%a6%c2%a7%c2%a8%c2%a9%c2%aa%c2%ab%c2%ac%c2%ad%c2%ae%c2%af%c2%b0%c2%b1%c2%b2%c2%b3%c2%b4%c2%b5%c2%b6%c2%b7%c2%b8%c2%b9%c2%ba%c2%bb%c2%bc%c2%bd%c2%be%c2%bf"
},
{
"ret" : 1,
"type" : "tfn",
"input" : "~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ",
"name" : "urlEncode",
"output" : "%7e%7f%c2%80%c2%81%c2%82%c2%83%c2%84%c2%85%c2%86%c2%87%c2%88%c2%89%c2%8a%c2%8b%c2%8c%c2%8d%c2%8e%c2%8f%c2%90%c2%91%c2%92%c2%93%c2%94%c2%95%c2%96%c2%97%c2%98%c2%99%c2%9a%c2%9b%c2%9c%c2%9d%c2%9e%c2%9f"
},
{
"output" : "Test+Case",
"name" : "urlEncode",
"input" : "Test Case",
"type" : "tfn",
"ret" : 1
},
{
"input" : "% ",
"type" : "tfn",
"name" : "urlEncode",
"ret" : 1,
"output" : "%25+"
},
{
"output" : "%250g+",
"ret" : 1,
"input" : "%0g ",
"name" : "urlEncode",
"type" : "tfn"
},
{
"input" : "%0 ",
"type" : "tfn",
"name" : "urlEncode",
"ret" : 1,
"output" : "%250+"
},
{
"ret" : 1,
"input" : "%g0 ",
"type" : "tfn",
"name" : "urlEncode",
"output" : "%25g0+"
},
{
"output" : "%25g+",
"type" : "tfn",
"input" : "%g ",
"name" : "urlEncode",
"ret" : 1
},
{
"output" : "%250%251%252%253%254%255%256%257%258%259%250%25a%25b%25c%25d%25e%25f",
"input" : "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f",
"name" : "urlEncode",
"type" : "tfn",
"ret" : 1
},
{
"output" : "%25g0%25g1%25g2%25g3%25g4%25g5%25g6%25g7%25g8%25g9%25g0%25ga%25gb%25gc%25gd%25ge%25gf",
"ret" : 1,
"input" : "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
"name" : "urlEncode",
"type" : "tfn"
},
{
"ret" : 1,
"type" : "tfn",
"input" : "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
"name" : "urlEncode",
"output" : "%250g%251g%252g%253g%254g%255g%256g%257g%258g%259g%250g%25ag%25bg%25cg%25dg%25eg%25fg"
},
{
"output" : "%25",
"input" : "%",
"name" : "urlEncode",
"type" : "tfn",
"ret" : 1
},
{
"type" : "tfn",
"input" : "%0",
"name" : "urlEncode",
"ret" : 1,
"output" : "%250"
},
{
"output" : "%25%25",
"input" : "%%",
"type" : "tfn",
"name" : "urlEncode",
"ret" : 1
},
{
"ret" : 1,
"input" : "%0g",
"type" : "tfn",
"name" : "urlEncode",
"output" : "%250g"
},
{
"output" : "%25gg",
"type" : "tfn",
"input" : "%gg",
"name" : "urlEncode",
"ret" : 1
}
]

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,49 @@
#!/usr/bin/perl -w
#
#
use strict;
use warnings;
use JSON;
my $dir = $ARGV[0];
my $out = $ARGV[1];
if (!($dir && $out))
{
die "Use: ./mport-modsec-unit-tests.pl /path/to/modsec/tests /path/to/dest\n\n";
}
opendir(DIR, $dir) or die "Failed to open: \"$!\"";
while (my $file = readdir(DIR))
{
my $orig_file = $file;
$file = $dir . "/" . $file;
next if not ($file =~ m/\.t$/);
open(CFG, "<$file") || die "Failed to open \"$file\": $!";
my @data = <CFG>;
my @C;
my $edata = q/@C = (/ . join("", @data) . q/)/;
eval $edata;
die "Failed to read test data \"$file\": $@" if ($@);
unless (@C) {
print "No tests defined for $file\n";
next;
}
print "Loaded ".@C." tests from $file\n";
my $json = to_json(\@C, {utf8 => 1, pretty => 1});
my ($new_file) = $orig_file =~ m/(.*)\.t$/;
$new_file = $out . "/" . $new_file . ".json";
open (DFG, ">$new_file" ) || die "Failed to open: \"$file\": $!";
print " Saving at: " . $new_file . "\n";
print DFG $json;
close(DFG);
close(CFG);
}
closedir(DIR);

View File

@ -0,0 +1,13 @@
/t/*
!/t/*.*
/t/*.exe
/t/*.got
*.a
*.lo
*.o
*.so
*.pc
usr/
*.sw?
/.deps
/.dirstamp

View File

@ -0,0 +1,13 @@
language: c
compiler:
- gcc
- clang
before_install: sudo apt-get install -y libtest-differences-perl
install: make CC=$CC install
script: make CC=$CC test
after_script: make uninstall

View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@ -0,0 +1,41 @@
To install libtap on a Unix-like system:
$ make
$ make check
$ make install
To compile with gcc -ansi, run:
$ ANSI=1 make
To install to a different directory than /usr/local, supply the
PREFIX variable to make:
$ PREFIX=/usr make install
On Windows, the library can be created by first setting up the
correct development environment variables. Usually this is done by
running vcvars32.bat included in the Visual Studio distribution.
You should also install gnu make which can be found at
http://gnuwin32.sourceforge.net/packages/make.htm. Once this is
done, you should be able to run the following:
> make -f Makefile.win
If you want to use it directly in another project, you can copy tap.c
and tap.h there and it shouldn't have a problem compiling.
$ ls
tap.c tap.h test.c
$ cat test.c
#include "tap.h"
int main () {
plan(1);
ok(50 + 5, "foo %s", "bar");
done_testing();
}
$ gcc test.c tap.c
$ a.out
1..1
ok 1 - foo bar

View File

@ -0,0 +1,37 @@
CFLAGS = /Zi /Wall /wd4255 /wd4996 /wd4127 /wd4820 /wd4100 /wd4619 \
/wd4514 /wd4668 /I.
CC = cl /nologo
TESTS = $(patsubst %.c, %.exe, $(wildcard t/*.c))
%.exe:
$(CC) $(LDFLAGS) $(filter %.obj %.lib %.dll, $^) $(LDLIBS) /Fe $@
%.o:
$(CC) $(CFLAGS) $(CPPFLAGS) /c $(filter %.c, $^) $(LDLIBS) /Fo $@
%.lib:
lib /nologo /out:$@ $(filter %.obj, $^)
%.dll:
lib /nologo /out:$@ $(filter %.obj, $^)
all: tap.lib tests
tap.lib: tap.obj
tap.obj: tap.c tap.h
tests: $(TESTS)
$(TESTS): %.exe: %.obj tap.lib
$(patsubst %.exe, %.obj, $(TESTS)): %.obj: %.c tap.h
clean:
rm -rf *.obj t/*.obj tap.lib $(TESTS)
check test: all
prove
.PHONY: all clean check test tests

View File

@ -0,0 +1,268 @@
NAME
====
libtap - Write tests in C
SYNOPSIS
========
#include <tap.h>
int main () {
plan(5);
int bronze = 1, silver = 2, gold = 3;
ok(bronze < silver, "bronze is less than silver");
ok(bronze > silver, "not quite");
is("gold", "gold", "gold is gold");
cmp_ok(silver, "<", gold, "%d <= %d", silver, gold);
like("platinum", ".*inum", "platinum matches .*inum");
done_testing();
}
results in:
1..5
ok 1 - bronze is less than silver
not ok 2 - not quite
# Failed test 'not quite'
# at t/synopsis.c line 7.
ok 3 - gold is gold
ok 4 - 2 <= 3
ok 5 - platinum matches .*inum
# Looks like you failed 1 test of 5 run.
DESCRIPTION
===========
tap is an easy to read and easy to write way of creating tests for
your software. This library creates functions that can be used to
generate it for your C programs. It is implemented using macros
that include file and line info automatically, and makes it so that
the format message of each test is optional. It is mostly based on
the Test::More Perl module.
INSTALL
=======
On **Unix** systems:
$ make
$ make install
For more detailed installation instructions (eg, for **Windows**), see `INSTALL`.
FUNCTIONS
=========
- plan(tests)
- plan(NO_PLAN)
- plan(SKIP_ALL);
- plan(SKIP_ALL, fmt, ...)
Use this to start a series of tests. When you know how many tests there
will be, you can put a number as a number of tests you expect to run. If
you do not know how many tests there will be, you can use plan(NO_PLAN)
or not call this function. When you pass it a number of tests to run, a
message similar to the following will appear in the output:
1..5
If you pass it SKIP_ALL, the whole test will be skipped.
- ok(test)
- ok(test, fmt, ...)
Specify a test. the test can be any statement returning a true or false
value. You may optionally pass a format string describing the test.
ok(r = reader_new("Of Mice and Men"), "create a new reader");
ok(reader_go_to_page(r, 55), "can turn the page");
ok(r->page == 55, "page turned to the right one");
Should print out:
ok 1 - create a new reader
ok 2 - can turn the page
ok 3 - page turned to the right one
On failure, a diagnostic message will be printed out.
not ok 3 - page turned to the right one
# Failed test 'page turned to the right one'
# at reader.c line 13.
- is(got, expected)
- is(got, expected, fmt, ...)
- isnt(got, unexpected)
- isnt(got, unexpected, fmt, ...)
Tests that the string you got is what you expected. with isnt, it is the
reverse.
is("this", "that", "this is that");
prints:
not ok 1 - this is that
# Failed test 'this is that'
# at is.c line 6.
# got: 'this'
# expected: 'that'
- cmp_ok(a, op, b)
- cmp_ok(a, op, b, fmt, ...)
Compares two ints with any binary operator that doesn't require an lvalue.
This is nice to use since it provides a better error message than an
equivalent ok.
cmp_ok(420, ">", 666);
prints:
not ok 1
# Failed test at cmpok.c line 5.
# 420
# >
# 666
- cmp_mem(got, expected, n)
- cmp_mem(got, expected, n, fmt, ...)
Tests that the first n bytes of the memory you got is what you expected.
NULL pointers for got and expected are handled (if either is NULL,
the test fails), but you need to ensure n is not too large.
char *a = "foo";
char *b = "bar";
cmp_mem(a, b, 3)
prints
not ok 1
# Failed test at t/cmp_mem.c line 9.
# Difference starts at offset 0
# got: 0x66
# expected: 0x62
- like(got, expected)
- like(got, expected, fmt, ...)
- unlike(got, unexpected)
- unlike(got, unexpected, fmt, ...)
Tests that the string you got matches the expected extended POSIX regex.
unlike is the reverse. These macros are the equivalent of a skip on
Windows.
like("stranger", "^s.(r).*\\1$", "matches the regex");
prints:
ok 1 - matches the regex
- pass()
- pass(fmt, ...)
- fail()
- fail(fmt, ...)
Speciy that a test succeeded or failed. Use these when the statement is
longer than you can fit into the argument given to an ok() test.
- dies_ok(code)
- dies_ok(code, fmt, ...)
- lives_ok(code)
- lives_ok(code, fmt, ...)
Tests whether the given code causes your program to exit. The code gets
passed to a macro that will test it in a forked process. If the code
succeeds it will be executed in the parent process. You can test things
like passing a function a null pointer and make sure it doesnt
dereference it and crash.
dies_ok({abort();}, "abort does close your program");
dies_ok({int x = 0/0;}, "divide by zero crash");
lives_ok({pow(3.0, 5.0);}, "nothing wrong with taking 3**5");
On Windows, these macros are the equivalent of a skip.
- done_testing()
Summarizes the tests that occurred and exits the main function. If
there was no plan, it will print out the number of tests as.
1..5
It will also print a diagnostic message about how many
failures there were.
# Looks like you failed 2 tests of 3 run.
If all planned tests were successful, it will return 0. If any
test fails, it will return 1. If they all passed, but there
were missing tests, it will return 2.
- diag(fmt, ...)
print out a message to the tap output on stdout. Each line is
preceeded by a "# " so that you know its a diagnostic message.
diag("This is\na diag\nto describe\nsomething.");
prints:
# This is
# a diag
# to describe
# something
ok() and this function return an int so you can use it like:
ok(0) || diag("doh!");
- skip(test, n)
- skip(test, n, fmt, ...)
- end_skip
Skip a series of n tests if test is true. You may give a reason why you are
skipping them or not. The (possibly) skipped tests must occur between the
skip and end_skip macros.
skip(TRUE, 2);
ok(1);
ok(0);
end_skip;
prints:
ok 1 # skip
ok 2 # skip
- todo()
- todo(fmt, ...)
- end_todo
Specifies a series of tests that you expect to fail because they are not
yet implemented.
todo()
ok(0);
end_todo;
prints:
not ok 1 # TODO
# Failed (TODO) test at todo.c line 7
- BAIL_OUT()
- BAIL_OUT(fmt, ...)
Immediately stops all testing.
BAIL_OUT("Can't go no further");
prints
Bail out! Can't go no further
and exits with 255.

View File

@ -0,0 +1,20 @@
#include "tap.h"
int main () {
unsigned char all_0[] = {0, 0, 0, 0};
unsigned char all_255[] = {255, 255, 255, 255};
unsigned char half[] = {0, 0, 255, 255};
unsigned char half_2[] = {0, 0, 255, 255};
plan(8);
cmp_mem(half, half_2, 4, "Same array different address");
cmp_mem(all_0, all_0, 4, "Array must be equal to itself");
cmp_mem(all_0, all_255, 4, "Arrays with different contents");
cmp_mem(all_0, half, 4, "Arrays differ, but start the same");
cmp_mem(all_0, all_255, 0, "Comparing 0 bytes of different arrays");
cmp_mem(NULL, all_0, 4, "got == NULL");
cmp_mem(all_0, NULL, 4, "expected == NULL");
cmp_mem(NULL, NULL, 4, "got == expected == NULL");
done_testing();
}

View File

@ -0,0 +1,28 @@
1..8
ok 1 - Same array different address
ok 2 - Array must be equal to itself
not ok 3 - Arrays with different contents
# Failed test 'Arrays with different contents'
# at t/cmp_mem.c line 12.
# Difference starts at offset 0
# got: 0x00
# expected: 0xff
not ok 4 - Arrays differ, but start the same
# Failed test 'Arrays differ, but start the same'
# at t/cmp_mem.c line 13.
# Difference starts at offset 2
# got: 0x00
# expected: 0xff
ok 5 - Comparing 0 bytes of different arrays
not ok 6 - got == NULL
# Failed test 'got == NULL'
# at t/cmp_mem.c line 15.
# got: NULL
# expected: not NULL
not ok 7 - expected == NULL
# Failed test 'expected == NULL'
# at t/cmp_mem.c line 16.
# got: not NULL
# expected: NULL
ok 8 - got == expected == NULL
# Looks like you failed 4 tests of 8 run.

View File

@ -0,0 +1,16 @@
#include "tap.h"
int main () {
plan(9);
cmp_ok(420, ">", 666);
cmp_ok(23, "==", 55, "the number 23 is definitely 55");
cmp_ok(23, "==", 55);
cmp_ok(23, "!=", 55);
cmp_ok(23, "frob", 55);
cmp_ok(23, "<=", 55);
cmp_ok(55, "+", -55);
cmp_ok(23, "%", 5);
cmp_ok(55, "%", 5);
done_testing();
}

View File

@ -0,0 +1,37 @@
1..9
not ok 1
# Failed test at t/cmpok.c line 5.
# 420
# >
# 666
not ok 2 - the number 23 is definitely 55
# Failed test 'the number 23 is definitely 55'
# at t/cmpok.c line 6.
# 23
# ==
# 55
not ok 3
# Failed test at t/cmpok.c line 7.
# 23
# ==
# 55
ok 4
# unrecognized operator 'frob'
not ok 5
# Failed test at t/cmpok.c line 9.
# 23
# frob
# 55
ok 6
not ok 7
# Failed test at t/cmpok.c line 11.
# 55
# +
# -55
ok 8
not ok 9
# Failed test at t/cmpok.c line 13.
# 55
# %
# 5
# Looks like you failed 6 tests of 9 run.

View File

@ -0,0 +1,10 @@
#include "tap.h"
int main () {
diag("diag no new line");
diag("diag new line\n");
diag("");
diag(NULL);
return 1;
}

View File

@ -0,0 +1,2 @@
# diag no new line
# diag new line

View File

@ -0,0 +1,14 @@
#include "tap.h"
int main () {
plan(5);
ok(1, "sanity");
dies_ok({int x = 0; x = 1/x;}, "can't divide by zero");
lives_ok({int x = 3; x = x/7;}, "this is a perfectly fine statement");
dies_ok({abort();}, "abort kills the program");
dies_ok(
{printf("stdout\n"); fprintf(stderr, "stderr\n"); abort();},
"supress output");
done_testing();
}

View File

@ -0,0 +1,6 @@
1..5
ok 1 - sanity
ok 2 - can't divide by zero
ok 3 - this is a perfectly fine statement
ok 4 - abort kills the program
ok 5 - supress output

View File

@ -0,0 +1,24 @@
#include "tap.h"
int main () {
plan(18);
is("this", "that", "this is that"); /* bang */
is("this", "this", "this is this");
is("this", "that"); /* bang */
is("this", "this");
is(NULL, NULL, "null is null");
is(NULL, "this", "null is this"); /* bang */
is("this", NULL, "this is null"); /* bang */
is("foo\nfoo\nfoo", "bar\nbar\nbar"); /* bang */
is("foo\nfoo\nfoo", "foo\nfoo\nfoo");
isnt("this", "that", "this isnt that");
isnt("this", "this", "this isnt this"); /* bang */
isnt("this", "that");
isnt("this", "this"); /* bang */
isnt(NULL, NULL, "null isnt null"); /* bang */
isnt(NULL, "this", "null isnt this");
isnt("this", NULL, "this isnt null");
isnt("foo\nfoo\nfoo", "bar\nbar\nbar");
isnt("foo\nfoo\nfoo", "foo\nfoo\nfoo"); /* bang */
done_testing();
}

View File

@ -0,0 +1,58 @@
1..18
not ok 1 - this is that
# Failed test 'this is that'
# at t/is.c line 5.
# got: 'this'
# expected: 'that'
ok 2 - this is this
not ok 3
# Failed test at t/is.c line 7.
# got: 'this'
# expected: 'that'
ok 4
ok 5 - null is null
not ok 6 - null is this
# Failed test 'null is this'
# at t/is.c line 10.
# got: '(null)'
# expected: 'this'
not ok 7 - this is null
# Failed test 'this is null'
# at t/is.c line 11.
# got: 'this'
# expected: '(null)'
not ok 8
# Failed test at t/is.c line 12.
# got: 'foo
# foo
# foo'
# expected: 'bar
# bar
# bar'
ok 9
ok 10 - this isnt that
not ok 11 - this isnt this
# Failed test 'this isnt this'
# at t/is.c line 15.
# got: 'this'
# expected: anything else
ok 12
not ok 13
# Failed test at t/is.c line 17.
# got: 'this'
# expected: anything else
not ok 14 - null isnt null
# Failed test 'null isnt null'
# at t/is.c line 18.
# got: '(null)'
# expected: anything else
ok 15 - null isnt this
ok 16 - this isnt null
ok 17
not ok 18
# Failed test at t/is.c line 22.
# got: 'foo
# foo
# foo'
# expected: anything else
# Looks like you failed 9 tests of 18 run.

View File

@ -0,0 +1,10 @@
#include "tap.h"
int main () {
plan(3);
like("strange", "range", "strange ~~ /range/");
unlike("strange", "anger", "strange !~~ /anger/");
like("stranger", "^s.(r).*$", "matches the regex");
done_testing();
}

View File

@ -0,0 +1,4 @@
1..3
ok 1 - strange ~~ /range/
ok 2 - strange !~~ /anger/
ok 3 - matches the regex

View File

@ -0,0 +1,31 @@
#include "tap.h"
int main () {
plan(24);
ok(1);
ok(1);
ok(1);
ok(0);
ok(1, "foo");
ok(1, "bar");
ok(1, "baz");
ok(1, "quux");
ok(1, "thud");
ok(1, "wombat");
ok(1, "blurgle");
ok(1, "frob");
ok(0, "frobnicate");
ok(1, "eek");
ok(1, "ook");
ok(1, "frodo");
ok(1, "bilbo");
ok(1, "wubble");
ok(1, "flarp");
ok(1, "fnord");
pass();
fail();
pass("good");
fail("bad");
done_testing();
}

View File

@ -0,0 +1,32 @@
1..24
ok 1
ok 2
ok 3
not ok 4
# Failed test at t/simple.c line 8.
ok 5 - foo
ok 6 - bar
ok 7 - baz
ok 8 - quux
ok 9 - thud
ok 10 - wombat
ok 11 - blurgle
ok 12 - frob
not ok 13 - frobnicate
# Failed test 'frobnicate'
# at t/simple.c line 17.
ok 14 - eek
ok 15 - ook
ok 16 - frodo
ok 17 - bilbo
ok 18 - wubble
ok 19 - flarp
ok 20 - fnord
ok 21
not ok 22
# Failed test at t/simple.c line 26.
ok 23 - good
not ok 24 - bad
# Failed test 'bad'
# at t/simple.c line 28.
# Looks like you failed 4 tests of 24 run.

View File

@ -0,0 +1,23 @@
#include "tap.h"
int main () {
plan(8);
skip(0, 3, "%s cannot fork", "windows");
ok(1, "quux");
ok(1, "thud");
ok(1, "wombat");
end_skip;
skip(1, 1, "need to be on windows");
ok(0, "blurgle");
end_skip;
skip(0, 3);
ok(1, "quux");
ok(1, "thud");
ok(1, "wombat");
end_skip;
skip(1, 1);
ok(0, "blurgle");
end_skip;
done_testing();
}

View File

@ -0,0 +1,9 @@
1..8
ok 1 - quux
ok 2 - thud
ok 3 - wombat
ok 4 # skip need to be on windows
ok 5 - quux
ok 6 - thud
ok 7 - wombat
ok 8 # skip

View File

@ -0,0 +1,13 @@
#include "tap.h"
int main () {
plan(5);
int bronze = 1, silver = 2, gold = 3;
ok(bronze < silver, "bronze is less than silver");
ok(bronze > silver, "not quite");
is("gold", "gold", "gold is gold");
cmp_ok(silver, "<", gold, "%d <= %d", silver, gold);
like("platinum", ".*inum", "platinum matches .*inum");
done_testing();
}

View File

@ -0,0 +1,9 @@
1..5
ok 1 - bronze is less than silver
not ok 2 - not quite
# Failed test 'not quite'
# at t/synopsis.c line 7.
ok 3 - gold is gold
ok 4 - 2 <= 3
ok 5 - platinum matches .*inum
# Looks like you failed 1 test of 5 run.

View File

@ -0,0 +1,28 @@
#include "tap.h"
#include <stdio.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
int main () {
DIR *dp = opendir("t");
if (!dp) {
perror("opendir");
exit(1);
}
struct dirent *ep;
while ((ep = readdir(dp))) {
char *name = ep->d_name;
if (strchr(name, '.') || !strcmp(name, "test"))
continue;
char command[1024];
snprintf(command, 1024, "./t/%s >t/%s.got 2>&1", name, name);
system(command);
snprintf(command, 1024, "diff -up t/%s.expected t/%s.got", name, name);
int retval = system(command);
ok(!(retval >> 8), name);
}
closedir(dp);
done_testing();
}

View File

@ -0,0 +1,17 @@
#include "tap.h"
int main () {
plan(6);
todo();
ok(0, "foo");
ok(1, "bar");
ok(1, "baz");
end_todo;
todo("im not ready");
ok(0, "quux");
ok(1, "thud");
ok(1, "wombat");
end_todo;
done_testing();
}

Some files were not shown because too many files have changed in this diff Show More