From c30c0616929a1965ff0e73ce5277074bfd5d4bb6 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Tue, 28 Oct 2025 15:21:21 -0400 Subject: [PATCH] Implement most W3C XML Schema 2004 primitive data types Signed-off-by: Juan Cruz Viotti --- README.markdown | 1 + schemas/w3c/xmlschema/2004/any-uri.json | 18 + schemas/w3c/xmlschema/2004/base64-binary.json | 18 + schemas/w3c/xmlschema/2004/boolean.json | 9 + schemas/w3c/xmlschema/2004/date-time.json | 17 + schemas/w3c/xmlschema/2004/date.json | 11 + schemas/w3c/xmlschema/2004/decimal.json | 18 + schemas/w3c/xmlschema/2004/double.json | 16 + schemas/w3c/xmlschema/2004/duration.json | 16 + schemas/w3c/xmlschema/2004/float.json | 16 + schemas/w3c/xmlschema/2004/g-day.json | 10 + schemas/w3c/xmlschema/2004/g-month-day.json | 10 + schemas/w3c/xmlschema/2004/g-month.json | 10 + schemas/w3c/xmlschema/2004/g-year-month.json | 11 + schemas/w3c/xmlschema/2004/g-year.json | 11 + schemas/w3c/xmlschema/2004/hex-binary.json | 9 + schemas/w3c/xmlschema/2004/string.json | 9 + schemas/w3c/xmlschema/2004/time.json | 17 + test/w3c/xmlschema/2004/any-uri.test.json | 391 +++++++++++++ .../xmlschema/2004/base64-binary.test.json | 526 ++++++++++++++++++ test/w3c/xmlschema/2004/boolean.test.json | 46 ++ test/w3c/xmlschema/2004/date-time.test.json | 126 +++++ test/w3c/xmlschema/2004/date.test.json | 121 ++++ test/w3c/xmlschema/2004/decimal.test.json | 361 ++++++++++++ test/w3c/xmlschema/2004/double.test.json | 96 ++++ test/w3c/xmlschema/2004/duration.test.json | 101 ++++ test/w3c/xmlschema/2004/float.test.json | 86 +++ test/w3c/xmlschema/2004/g-day.test.json | 76 +++ test/w3c/xmlschema/2004/g-month-day.test.json | 96 ++++ test/w3c/xmlschema/2004/g-month.test.json | 81 +++ .../w3c/xmlschema/2004/g-year-month.test.json | 96 ++++ test/w3c/xmlschema/2004/g-year.test.json | 86 +++ test/w3c/xmlschema/2004/hex-binary.test.json | 501 +++++++++++++++++ test/w3c/xmlschema/2004/string.test.json | 56 ++ test/w3c/xmlschema/2004/time.test.json | 101 ++++ 35 files changed, 3174 insertions(+) create mode 100644 schemas/w3c/xmlschema/2004/any-uri.json create mode 100644 schemas/w3c/xmlschema/2004/base64-binary.json create mode 100644 schemas/w3c/xmlschema/2004/boolean.json create mode 100644 schemas/w3c/xmlschema/2004/date-time.json create mode 100644 schemas/w3c/xmlschema/2004/date.json create mode 100644 schemas/w3c/xmlschema/2004/decimal.json create mode 100644 schemas/w3c/xmlschema/2004/double.json create mode 100644 schemas/w3c/xmlschema/2004/duration.json create mode 100644 schemas/w3c/xmlschema/2004/float.json create mode 100644 schemas/w3c/xmlschema/2004/g-day.json create mode 100644 schemas/w3c/xmlschema/2004/g-month-day.json create mode 100644 schemas/w3c/xmlschema/2004/g-month.json create mode 100644 schemas/w3c/xmlschema/2004/g-year-month.json create mode 100644 schemas/w3c/xmlschema/2004/g-year.json create mode 100644 schemas/w3c/xmlschema/2004/hex-binary.json create mode 100644 schemas/w3c/xmlschema/2004/string.json create mode 100644 schemas/w3c/xmlschema/2004/time.json create mode 100644 test/w3c/xmlschema/2004/any-uri.test.json create mode 100644 test/w3c/xmlschema/2004/base64-binary.test.json create mode 100644 test/w3c/xmlschema/2004/boolean.test.json create mode 100644 test/w3c/xmlschema/2004/date-time.test.json create mode 100644 test/w3c/xmlschema/2004/date.test.json create mode 100644 test/w3c/xmlschema/2004/decimal.test.json create mode 100644 test/w3c/xmlschema/2004/double.test.json create mode 100644 test/w3c/xmlschema/2004/duration.test.json create mode 100644 test/w3c/xmlschema/2004/float.test.json create mode 100644 test/w3c/xmlschema/2004/g-day.test.json create mode 100644 test/w3c/xmlschema/2004/g-month-day.test.json create mode 100644 test/w3c/xmlschema/2004/g-month.test.json create mode 100644 test/w3c/xmlschema/2004/g-year-month.test.json create mode 100644 test/w3c/xmlschema/2004/g-year.test.json create mode 100644 test/w3c/xmlschema/2004/hex-binary.test.json create mode 100644 test/w3c/xmlschema/2004/string.test.json create mode 100644 test/w3c/xmlschema/2004/time.test.json diff --git a/README.markdown b/README.markdown index 324024f..95f0135 100644 --- a/README.markdown +++ b/README.markdown @@ -72,6 +72,7 @@ expressed as JSON Schema definitions. | ISO/IEC | [ISO/IEC 9899:2024](https://www.iso.org/standard/82075.html) | Programming languages — C | | JSON-RPC | [JSON-RPC 2.0](https://www.jsonrpc.org/specification) | JSON-RPC 2.0 Specification | | JSON Schema | [Draft 2020-12](https://json-schema.org/draft/2020-12/json-schema-core) | JSON Schema: A Media Type for Describing JSON Documents | +| W3C | [XML Schema Part 2: Datatypes Second Edition](https://www.w3.org/TR/xmlschema-2/) | W3C Recommendation 28 October 2004 | To request coverage of another standard, please [open an issue on GitHub](https://github.com/sourcemeta/std/issues). diff --git a/schemas/w3c/xmlschema/2004/any-uri.json b/schemas/w3c/xmlschema/2004/any-uri.json new file mode 100644 index 0000000..577c6cc --- /dev/null +++ b/schemas/w3c/xmlschema/2004/any-uri.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema anyURI", + "description": "The anyURI datatype represents a Uniform Resource Identifier Reference (URI) (§3.2.17)", + "examples": [ + "http://www.example.com", + "https://www.example.com/path/to/resource", + "ftp://ftp.example.com/file.txt", + "mailto:user@example.com", + "../relative/path.html", + "http://www.example.com/path#fragment", + "urn:isbn:0-395-36341-1", + "" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#anyURI" ], + "$ref": "../../../ietf/uri/uri-reference.json" +} diff --git a/schemas/w3c/xmlschema/2004/base64-binary.json b/schemas/w3c/xmlschema/2004/base64-binary.json new file mode 100644 index 0000000..52ec3ae --- /dev/null +++ b/schemas/w3c/xmlschema/2004/base64-binary.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema base64Binary", + "description": "The base64Binary datatype represents Base64-encoded arbitrary binary data (§3.2.16)", + "examples": [ + "R0lGODlhAQABAAAAACw=", + "SGVsbG8gV29ybGQh", + "YQ==", + "YWI=", + "YWJj", + "" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#base64Binary" ], + "$ref": "../../../ietf/encoding/base64.json", + "contentEncoding": "base64", + "contentMediaType": "application/octet-stream" +} diff --git a/schemas/w3c/xmlschema/2004/boolean.json b/schemas/w3c/xmlschema/2004/boolean.json new file mode 100644 index 0000000..f1535d0 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/boolean.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema boolean", + "description": "The boolean datatype represents binary logic values (§3.2.2)", + "examples": [ true, false ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#boolean" ], + "type": "boolean" +} diff --git a/schemas/w3c/xmlschema/2004/date-time.json b/schemas/w3c/xmlschema/2004/date-time.json new file mode 100644 index 0000000..5916101 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/date-time.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema dateTime", + "description": "The dateTime datatype represents a specific instant of time (§3.2.7)", + "$comment": "Year 0000 is not allowed in XML Schema 1.0. Leap year validation is consumer responsibility", + "examples": [ + "2002-10-10T12:00:00-05:00", + "2002-10-10T17:00:00Z", + "2002-10-10T12:00:00", + "2002-05-30T09:00:00", + "-2002-10-10T12:00:00" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#dateTime" ], + "type": "string", + "pattern": "^-?((?!0000)[0-9]{4}-(0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(?!0000)[0-9]{4}-(0[469]|11)-(0[1-9]|[12][0-9]|30)|(?!0000)[0-9]{4}-02-(0[1-9]|1[0-9]|2[0-9]))T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])?$" +} diff --git a/schemas/w3c/xmlschema/2004/date.json b/schemas/w3c/xmlschema/2004/date.json new file mode 100644 index 0000000..4e54220 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/date.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema date", + "description": "The date datatype represents a calendar date (§3.2.9)", + "$comment": "Year 0000 is not allowed in XML Schema 1.0. Leap year validation is consumer responsibility", + "examples": [ "2002-10-10", "2002-10-10+13:00", "2002-10-10Z", "-2002-10-10" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#date" ], + "type": "string", + "pattern": "^-?((?!0000)[0-9]{4}-(0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(?!0000)[0-9]{4}-(0[469]|11)-(0[1-9]|[12][0-9]|30)|(?!0000)[0-9]{4}-02-(0[1-9]|1[0-9]|2[0-9]))(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])?$" +} diff --git a/schemas/w3c/xmlschema/2004/decimal.json b/schemas/w3c/xmlschema/2004/decimal.json new file mode 100644 index 0000000..024cc0e --- /dev/null +++ b/schemas/w3c/xmlschema/2004/decimal.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema decimal", + "description": "The decimal datatype represents arbitrary precision decimal numbers (§3.2.3)", + "examples": [ + "-1.23", + "12678967.543233", + "+100000.00", + "210", + "0", + "-0", + "3.14159265358979323846" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#decimal" ], + "type": "string", + "pattern": "^[+-]?([0-9]+\\.[0-9]+|[0-9]+)$" +} diff --git a/schemas/w3c/xmlschema/2004/double.json b/schemas/w3c/xmlschema/2004/double.json new file mode 100644 index 0000000..264d89d --- /dev/null +++ b/schemas/w3c/xmlschema/2004/double.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema double", + "description": "The double datatype corresponds to IEEE double-precision 64-bit floating point (§3.2.5)", + "examples": [ 0.0, 1.5, -3.14159, "INF", "-INF", "NaN" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#double" ], + "anyOf": [ + { + "$ref": "../../../ieee/floating-point/2019/binary64.json" + }, + { + "enum": [ "INF", "-INF", "NaN" ] + } + ] +} diff --git a/schemas/w3c/xmlschema/2004/duration.json b/schemas/w3c/xmlschema/2004/duration.json new file mode 100644 index 0000000..99df7b4 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/duration.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema duration", + "description": "The duration datatype represents a duration of time in ISO 8601 format with optional minus sign for negative durations (§3.2.6)", + "examples": [ + "P1Y2M3DT10H30M", + "-P120D", + "P1347Y", + "P1347M", + "P1Y2MT2H", + "-P1347M" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#duration" ], + "$ref": "../../../iso/datetime/2019/duration/designator-extension.json" +} diff --git a/schemas/w3c/xmlschema/2004/float.json b/schemas/w3c/xmlschema/2004/float.json new file mode 100644 index 0000000..2935719 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/float.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema float", + "description": "The float datatype corresponds to IEEE single-precision 32-bit floating point (§3.2.4)", + "examples": [ 0.0, 1.5, -3.14, "INF", "-INF", "NaN" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#float" ], + "anyOf": [ + { + "$ref": "../../../ieee/floating-point/2019/binary32.json" + }, + { + "enum": [ "INF", "-INF", "NaN" ] + } + ] +} diff --git a/schemas/w3c/xmlschema/2004/g-day.json b/schemas/w3c/xmlschema/2004/g-day.json new file mode 100644 index 0000000..40a9f52 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/g-day.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema gDay", + "description": "The gDay datatype represents a day that recurs every month (§3.2.13)", + "examples": [ "---15", "---15Z", "---15+01:00", "---01", "---31" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#gDay" ], + "type": "string", + "pattern": "^---(0[1-9]|[12][0-9]|3[01])(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])?$" +} diff --git a/schemas/w3c/xmlschema/2004/g-month-day.json b/schemas/w3c/xmlschema/2004/g-month-day.json new file mode 100644 index 0000000..7ec6c83 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/g-month-day.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema gMonthDay", + "description": "The gMonthDay datatype represents a specific day in a month (§3.2.12)", + "examples": [ "--09-14", "--09-14Z", "--09-14+01:00", "--02-29" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#gMonthDay" ], + "type": "string", + "pattern": "^(--(0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|--02-(0[1-9]|1[0-9]|2[0-9])|--(0[469]|11)-(0[1-9]|[12][0-9]|30))(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])?$" +} diff --git a/schemas/w3c/xmlschema/2004/g-month.json b/schemas/w3c/xmlschema/2004/g-month.json new file mode 100644 index 0000000..5a90805 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/g-month.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema gMonth", + "description": "The gMonth datatype represents a month that recurs every year (§3.2.14)", + "examples": [ "--11", "--11Z", "--11+01:00", "--01", "--12" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#gMonth" ], + "type": "string", + "pattern": "^--(0[1-9]|1[0-2])(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])?$" +} diff --git a/schemas/w3c/xmlschema/2004/g-year-month.json b/schemas/w3c/xmlschema/2004/g-year-month.json new file mode 100644 index 0000000..50aaeb7 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/g-year-month.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema gYearMonth", + "description": "The gYearMonth datatype represents a specific gregorian month in a specific gregorian year (§3.2.10)", + "$comment": "Year 0000 is not allowed in XML Schema 1.0", + "examples": [ "1999-05", "1999-05Z", "1999-05+01:00", "-1999-05" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#gYearMonth" ], + "type": "string", + "pattern": "^-?(?!0000)[0-9]{4}-(0[1-9]|1[0-2])(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])?$" +} diff --git a/schemas/w3c/xmlschema/2004/g-year.json b/schemas/w3c/xmlschema/2004/g-year.json new file mode 100644 index 0000000..6987c4c --- /dev/null +++ b/schemas/w3c/xmlschema/2004/g-year.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema gYear", + "description": "The gYear datatype represents a gregorian calendar year (§3.2.11)", + "$comment": "Year 0000 is not allowed in XML Schema 1.0", + "examples": [ "1999", "1999Z", "1999+01:00", "-1999" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#gYear" ], + "type": "string", + "pattern": "^-?(?!0000)[0-9]{4}(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])?$" +} diff --git a/schemas/w3c/xmlschema/2004/hex-binary.json b/schemas/w3c/xmlschema/2004/hex-binary.json new file mode 100644 index 0000000..dfe0e09 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/hex-binary.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema hexBinary", + "description": "The hexBinary datatype represents arbitrary hex-encoded binary data (§3.2.15)", + "examples": [ "0FB7", "0fb7", "0123456789ABCDEF", "DEADBEEF", "" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#hexBinary" ], + "$ref": "../../../ietf/encoding/base16.json" +} diff --git a/schemas/w3c/xmlschema/2004/string.json b/schemas/w3c/xmlschema/2004/string.json new file mode 100644 index 0000000..44bcb34 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/string.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema string", + "description": "The string datatype represents character strings in XML (§3.2.1)", + "examples": [ "Hello World", "", "Line 1\nLine 2", "Multiple spaces" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#string" ], + "type": "string" +} diff --git a/schemas/w3c/xmlschema/2004/time.json b/schemas/w3c/xmlschema/2004/time.json new file mode 100644 index 0000000..36705d8 --- /dev/null +++ b/schemas/w3c/xmlschema/2004/time.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "W3C XML Schema time", + "description": "The time datatype represents an instant of time that recurs every day (§3.2.8)", + "$comment": "Hour 24 is only valid as 24:00:00", + "examples": [ + "13:20:00-05:00", + "13:20:00Z", + "13:20:00", + "00:00:00", + "24:00:00" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.w3.org/TR/xmlschema-2/#time" ], + "type": "string", + "pattern": "^(([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?|24:00:00)(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])?$" +} diff --git a/test/w3c/xmlschema/2004/any-uri.test.json b/test/w3c/xmlschema/2004/any-uri.test.json new file mode 100644 index 0000000..cbada71 --- /dev/null +++ b/test/w3c/xmlschema/2004/any-uri.test.json @@ -0,0 +1,391 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/any-uri.json", + "tests": [ + { + "description": "Valid - empty string", + "data": "", + "valid": true + }, + { + "description": "Valid - HTTP URL", + "data": "http://www.example.com", + "valid": true + }, + { + "description": "Valid - HTTPS URL", + "data": "https://www.example.com/path/to/resource", + "valid": true + }, + { + "description": "Valid - FTP URL", + "data": "ftp://ftp.example.com/file.txt", + "valid": true + }, + { + "description": "Valid - mailto URL", + "data": "mailto:user@example.com", + "valid": true + }, + { + "description": "Valid - file URL", + "data": "file:///path/to/file.txt", + "valid": true + }, + { + "description": "Valid - relative path", + "data": "../relative/path.html", + "valid": true + }, + { + "description": "Valid - absolute path", + "data": "/absolute/path/to/resource", + "valid": true + }, + { + "description": "Valid - with fragment", + "data": "http://www.example.com#fragment", + "valid": true + }, + { + "description": "Valid - with query string", + "data": "http://www.example.com?key=value&foo=bar", + "valid": true + }, + { + "description": "Valid - with port", + "data": "http://www.example.com:8080/path", + "valid": true + }, + { + "description": "Valid - URN", + "data": "urn:isbn:0-395-36341-1", + "valid": true + }, + { + "description": "Valid - data URI", + "data": "data:text/plain;charset=UTF-8;page=21,the%20data:1234,5678", + "valid": true + }, + { + "description": "Valid - with encoded characters", + "data": "http://www.example.com/%C3%A9dition.html", + "valid": true + }, + { + "description": "Valid - with non-ASCII characters", + "data": "http://www.example.com/édition.html", + "valid": true + }, + { + "description": "Valid - relative with dot segments", + "data": "./file.txt", + "valid": true + }, + { + "description": "Valid - relative with parent", + "data": "../../file.txt", + "valid": true + }, + { + "description": "Valid - just filename", + "data": "file.txt", + "valid": true + }, + { + "description": "Invalid - with unencoded space", + "data": "http://www.example.com/file with spaces.txt", + "valid": false + }, + { + "description": "Valid - IPv6 host", + "data": "http://[2001:db8::1]:8080/path", + "valid": true + }, + { + "description": "Valid - fragment only", + "data": "#section", + "valid": true + }, + { + "description": "Valid - query only", + "data": "?query=value", + "valid": true + }, + { + "description": "Valid - tel URI", + "data": "tel:+1-816-555-1212", + "valid": true + }, + { + "description": "Valid - javascript protocol", + "data": "javascript:alert('test')", + "valid": true + }, + { + "description": "Invalid - number type", + "data": 123, + "valid": false + }, + { + "description": "Invalid - boolean type", + "data": true, + "valid": false + }, + { + "description": "Invalid - null type", + "data": null, + "valid": false + }, + { + "description": "Invalid - object type", + "data": {}, + "valid": false + }, + { + "description": "Invalid - array type", + "data": [], + "valid": false + }, + { + "description": "Valid - HTTPS with path and query", + "data": "https://example.com/path?key=value", + "valid": true + }, + { + "description": "Valid - FTP with username", + "data": "ftp://user@ftp.example.com/file", + "valid": true + }, + { + "description": "Valid - HTTP with port and path", + "data": "http://example.com:3000/api", + "valid": true + }, + { + "description": "Valid - file protocol Unix path", + "data": "file:///usr/local/bin/app", + "valid": true + }, + { + "description": "Valid - file protocol Windows path", + "data": "file:///C:/Users/test/file.txt", + "valid": true + }, + { + "description": "Valid - mailto with subject", + "data": "mailto:test@example.com?subject=Hello", + "valid": true + }, + { + "description": "Valid - tel with extension", + "data": "tel:+1-816-555-1212;ext=123", + "valid": true + }, + { + "description": "Valid - data URI base64", + "data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA", + "valid": true + }, + { + "description": "Valid - news protocol", + "data": "news:comp.infosystems.www.servers.unix", + "valid": true + }, + { + "description": "Valid - nntp protocol", + "data": "nntp://news.example.com/example.group.this", + "valid": true + }, + { + "description": "Valid - telnet protocol", + "data": "telnet://192.0.2.16:80/", + "valid": true + }, + { + "description": "Valid - wais protocol", + "data": "wais://example.com/database", + "valid": true + }, + { + "description": "Valid - prospero protocol", + "data": "prospero://host.dom/link", + "valid": true + }, + { + "description": "Valid - relative path with query", + "data": "path/to/file?query=string", + "valid": true + }, + { + "description": "Valid - relative path with fragment", + "data": "page.html#section", + "valid": true + }, + { + "description": "Valid - absolute path with query and fragment", + "data": "/path/page?q=1#top", + "valid": true + }, + { + "description": "Valid - current directory reference", + "data": "./file.txt", + "valid": true + }, + { + "description": "Valid - parent directory multiple levels", + "data": "../../../file.txt", + "valid": true + }, + { + "description": "Valid - complex relative path", + "data": "../dir1/./dir2/../file.txt", + "valid": true + }, + { + "description": "Valid - URN ISBN", + "data": "urn:isbn:0451450523", + "valid": true + }, + { + "description": "Valid - URN ISSN", + "data": "urn:issn:0167-6423", + "valid": true + }, + { + "description": "Valid - URN UUID", + "data": "urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66", + "valid": true + }, + { + "description": "Valid - URN OID", + "data": "urn:oid:2.16.840", + "valid": true + }, + { + "description": "Valid - HTTP with authentication", + "data": "http://user:pass@example.com/", + "valid": true + }, + { + "description": "Valid - IPv4 address", + "data": "http://192.168.1.1/", + "valid": true + }, + { + "description": "Valid - IPv4 with port", + "data": "http://192.168.1.1:8080/path", + "valid": true + }, + { + "description": "Valid - IPv6 localhost", + "data": "http://[::1]/", + "valid": true + }, + { + "description": "Valid - IPv6 full address", + "data": "http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]/", + "valid": true + }, + { + "description": "Valid - IPv6 compressed", + "data": "http://[2001:db8::1]/", + "valid": true + }, + { + "description": "Valid - query string only", + "data": "?query=value", + "valid": true + }, + { + "description": "Valid - fragment only", + "data": "#anchor", + "valid": true + }, + { + "description": "Valid - multiple query parameters", + "data": "http://example.com?a=1&b=2&c=3", + "valid": true + }, + { + "description": "Valid - encoded characters in path", + "data": "http://example.com/path%20with%20spaces", + "valid": true + }, + { + "description": "Valid - encoded characters in query", + "data": "http://example.com?key=value%20here", + "valid": true + }, + { + "description": "Valid - complex query with encoded chars", + "data": "http://example.com?a=b&c=%2Fd%2Fe", + "valid": true + }, + { + "description": "Valid - long subdomain chain", + "data": "http://sub1.sub2.sub3.example.com/", + "valid": true + }, + { + "description": "Valid - hyphenated domain", + "data": "http://my-domain.example.com/", + "valid": true + }, + { + "description": "Valid - numbered subdomain", + "data": "http://server1.example.com/", + "valid": true + }, + { + "description": "Valid - TLD only", + "data": "http://localhost/", + "valid": true + }, + { + "description": "Valid - custom scheme", + "data": "myapp://open/document", + "valid": true + }, + { + "description": "Valid - scheme with plus", + "data": "git+https://github.com/user/repo.git", + "valid": true + }, + { + "description": "Valid - scheme with dot", + "data": "my.scheme://example", + "valid": true + }, + { + "description": "Valid - scheme with hyphen", + "data": "my-scheme://example", + "valid": true + }, + { + "description": "Valid - path with tilde", + "data": "http://example.com/~user/", + "valid": true + }, + { + "description": "Valid - path with dot files", + "data": "http://example.com/.well-known/", + "valid": true + }, + { + "description": "Valid - empty path after domain", + "data": "http://example.com", + "valid": true + }, + { + "description": "Valid - trailing slash", + "data": "http://example.com/", + "valid": true + }, + { + "description": "Valid - no trailing slash on path", + "data": "http://example.com/path", + "valid": true + } + ] +} diff --git a/test/w3c/xmlschema/2004/base64-binary.test.json b/test/w3c/xmlschema/2004/base64-binary.test.json new file mode 100644 index 0000000..a55290c --- /dev/null +++ b/test/w3c/xmlschema/2004/base64-binary.test.json @@ -0,0 +1,526 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/base64-binary.json", + "tests": [ + { + "description": "Valid - empty string", + "data": "", + "valid": true + }, + { + "description": "Valid - single char with padding", + "data": "YQ==", + "valid": true + }, + { + "description": "Valid - two chars with padding", + "data": "YWI=", + "valid": true + }, + { + "description": "Valid - three chars no padding", + "data": "YWJj", + "valid": true + }, + { + "description": "Valid - four chars", + "data": "YWJjZA==", + "valid": true + }, + { + "description": "Valid - Hello World", + "data": "SGVsbG8gV29ybGQh", + "valid": true + }, + { + "description": "Invalid - insufficient chars in final group", + "data": "a+b/c==", + "valid": false + }, + { + "description": "Valid - with plus sign", + "data": "a+b/cg==", + "valid": true + }, + { + "description": "Valid - with slash", + "data": "abc/def=", + "valid": true + }, + { + "description": "Valid - all uppercase", + "data": "QUJDRA==", + "valid": true + }, + { + "description": "Valid - all lowercase", + "data": "cXdlcg==", + "valid": true + }, + { + "description": "Valid - all digits", + "data": "MTIzNDU2Nzg5MA==", + "valid": true + }, + { + "description": "Valid - GIF header", + "data": "R0lGODlhAQABAAAAACw=", + "valid": true + }, + { + "description": "Valid - multiple of 4 chars", + "data": "YWJjZGVmZ2hpamtsbW5vcA==", + "valid": true + }, + { + "description": "Valid - long string", + "data": "VGhpcyBpcyBhIGxvbmcgYmFzZTY0IGVuY29kZWQgc3RyaW5nIHRoYXQgc2hvdWxkIGJlIHZhbGlk", + "valid": true + }, + { + "description": "Invalid - one equals padding only", + "data": "YWI==", + "valid": false + }, + { + "description": "Invalid - three equals", + "data": "YQ===", + "valid": false + }, + { + "description": "Invalid - padding in middle", + "data": "YQ==YWI=", + "valid": false + }, + { + "description": "Invalid - padding not at end", + "data": "Y=WI", + "valid": false + }, + { + "description": "Invalid - single character without padding (insufficient data)", + "data": "Y", + "valid": false + }, + { + "description": "Invalid - two characters without required padding", + "data": "YW", + "valid": false + }, + { + "description": "Invalid - three characters without required padding", + "data": "YWJ", + "valid": false + }, + { + "description": "Invalid - contains space", + "data": "YWJj ZA==", + "valid": false + }, + { + "description": "Invalid - contains dash", + "data": "YWJj-ZA==", + "valid": false + }, + { + "description": "Invalid - contains underscore", + "data": "YWJj_ZA==", + "valid": false + }, + { + "description": "Invalid - contains period", + "data": "YWJj.ZA==", + "valid": false + }, + { + "description": "Invalid - contains comma", + "data": "YWJj,ZA==", + "valid": false + }, + { + "description": "Invalid - contains special char", + "data": "YWJj@ZA==", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 123, + "valid": false + }, + { + "description": "Invalid - boolean type", + "data": true, + "valid": false + }, + { + "description": "Invalid - null type", + "data": null, + "valid": false + }, + { + "description": "Valid - only uppercase letters", + "data": "ABCDEFGH", + "valid": true + }, + { + "description": "Valid - only lowercase letters", + "data": "abcdefgh", + "valid": true + }, + { + "description": "Valid - only digits", + "data": "01234567", + "valid": true + }, + { + "description": "Valid - plus at start", + "data": "+ABC", + "valid": true + }, + { + "description": "Valid - slash at start", + "data": "/ABC", + "valid": true + }, + { + "description": "Valid - plus at end", + "data": "ABC+", + "valid": true + }, + { + "description": "Valid - slash at end", + "data": "ABC/", + "valid": true + }, + { + "description": "Valid - multiple plus signs", + "data": "A+B+C+D+", + "valid": true + }, + { + "description": "Valid - multiple slashes", + "data": "A/B/C/D/", + "valid": true + }, + { + "description": "Valid - plus and slash mixed", + "data": "A+B/C+D/", + "valid": true + }, + { + "description": "Valid - 8 chars no padding", + "data": "ABCDEFGH", + "valid": true + }, + { + "description": "Valid - 12 chars no padding", + "data": "ABCDEFGHIJKL", + "valid": true + }, + { + "description": "Valid - 16 chars no padding", + "data": "ABCDEFGHIJKLMNOP", + "valid": true + }, + { + "description": "Invalid - 5 chars without required padding", + "data": "ABCDE", + "valid": false + }, + { + "description": "Invalid - 6 chars without required padding", + "data": "ABCDEF", + "valid": false + }, + { + "description": "Invalid - 7 chars without required padding", + "data": "ABCDEFG", + "valid": false + }, + { + "description": "Invalid - 10 chars without required padding", + "data": "ABCDEFGHIJ", + "valid": false + }, + { + "description": "Valid - padding with two equals at end of 4-char group", + "data": "AB==", + "valid": true + }, + { + "description": "Valid - padding with one equal at end of 4-char group", + "data": "ABC=", + "valid": true + }, + { + "description": "Valid - 8 chars then padding", + "data": "ABCDEFGH/w==", + "valid": true + }, + { + "description": "Valid - all char types", + "data": "AZ09+/AB", + "valid": true + }, + { + "description": "Valid - repeated patterns", + "data": "AAAABBBBCCCCDDDD", + "valid": true + }, + { + "description": "Valid - zeros encoded", + "data": "AAAA", + "valid": true + }, + { + "description": "Valid - max values encoded", + "data": "////", + "valid": true + }, + { + "description": "Valid - alternating chars", + "data": "AaAaAaAa", + "valid": true + }, + { + "description": "Invalid - padding at beginning", + "data": "==ABCD", + "valid": false + }, + { + "description": "Invalid - padding in first position", + "data": "=ABC", + "valid": false + }, + { + "description": "Invalid - only equals", + "data": "====", + "valid": false + }, + { + "description": "Invalid - single equals", + "data": "=", + "valid": false + }, + { + "description": "Invalid - double equals alone", + "data": "==", + "valid": false + }, + { + "description": "Invalid - four equals", + "data": "ABCD====", + "valid": false + }, + { + "description": "Invalid - padding then more chars", + "data": "AB==CD", + "valid": false + }, + { + "description": "Invalid - padding then padding", + "data": "AB===", + "valid": false + }, + { + "description": "Invalid - mixed padding positions", + "data": "A=B=", + "valid": false + }, + { + "description": "Invalid - three chars with two equals", + "data": "ABC==", + "valid": false + }, + { + "description": "Invalid - two chars with one equal", + "data": "AB=", + "valid": false + }, + { + "description": "Invalid - five chars with padding", + "data": "ABCDE=", + "valid": false + }, + { + "description": "Valid - uppercase G", + "data": "ABCG", + "valid": true + }, + { + "description": "Valid - lowercase g", + "data": "ABCg", + "valid": true + }, + { + "description": "Invalid - contains (", + "data": "ABC(", + "valid": false + }, + { + "description": "Invalid - contains )", + "data": "ABC)", + "valid": false + }, + { + "description": "Invalid - contains [", + "data": "ABC[", + "valid": false + }, + { + "description": "Invalid - contains ]", + "data": "ABC]", + "valid": false + }, + { + "description": "Invalid - contains {", + "data": "ABC{", + "valid": false + }, + { + "description": "Invalid - contains }", + "data": "ABC}", + "valid": false + }, + { + "description": "Invalid - contains !", + "data": "ABC!", + "valid": false + }, + { + "description": "Invalid - contains ?", + "data": "ABC?", + "valid": false + }, + { + "description": "Invalid - contains *", + "data": "ABC*", + "valid": false + }, + { + "description": "Invalid - contains &", + "data": "ABC&", + "valid": false + }, + { + "description": "Invalid - contains $", + "data": "ABC$", + "valid": false + }, + { + "description": "Invalid - contains %", + "data": "ABC%", + "valid": false + }, + { + "description": "Invalid - contains #", + "data": "ABC#", + "valid": false + }, + { + "description": "Invalid - contains ^", + "data": "ABC^", + "valid": false + }, + { + "description": "Invalid - contains ~", + "data": "ABC~", + "valid": false + }, + { + "description": "Invalid - contains `", + "data": "ABC`", + "valid": false + }, + { + "description": "Invalid - contains |", + "data": "ABC|", + "valid": false + }, + { + "description": "Invalid - contains \\", + "data": "ABC\\", + "valid": false + }, + { + "description": "Invalid - contains ;", + "data": "ABC;", + "valid": false + }, + { + "description": "Invalid - contains :", + "data": "ABC:", + "valid": false + }, + { + "description": "Invalid - contains '", + "data": "ABC'", + "valid": false + }, + { + "description": "Invalid - contains \"", + "data": "ABC\"", + "valid": false + }, + { + "description": "Invalid - contains <", + "data": "ABC<", + "valid": false + }, + { + "description": "Invalid - contains >", + "data": "ABC>", + "valid": false + }, + { + "description": "Invalid - leading tab", + "data": "\tABCD", + "valid": false + }, + { + "description": "Invalid - trailing tab", + "data": "ABCD\t", + "valid": false + }, + { + "description": "Invalid - tab in middle", + "data": "AB\tCD", + "valid": false + }, + { + "description": "Invalid - leading space", + "data": " ABCD", + "valid": false + }, + { + "description": "Invalid - trailing space", + "data": "ABCD ", + "valid": false + }, + { + "description": "Invalid - multiple spaces", + "data": "AB CD", + "valid": false + }, + { + "description": "Invalid - contains carriage return", + "data": "AB\rCD", + "valid": false + }, + { + "description": "Invalid - non-ASCII character", + "data": "ABCé", + "valid": false + }, + { + "description": "Invalid - emoji", + "data": "ABC😀", + "valid": false + }, + { + "description": "Valid - very long valid base64", + "data": "VGhpcyBpcyBhIHZlcnkgbG9uZyBiYXNlNjQgZW5jb2RlZCBzdHJpbmcgdGhhdCB3ZSBhcmUgdXNpbmcgdG8gdGVzdCB0aGUgdmFsaWRhdGlvbiBvZiBsb25nZXIgaW5wdXRzIHRvIG1ha2Ugc3VyZSBvdXIgcGF0dGVybiB3b3JrcyBjb3JyZWN0bHk=", + "valid": true + } + ] +} diff --git a/test/w3c/xmlschema/2004/boolean.test.json b/test/w3c/xmlschema/2004/boolean.test.json new file mode 100644 index 0000000..e9e4a59 --- /dev/null +++ b/test/w3c/xmlschema/2004/boolean.test.json @@ -0,0 +1,46 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/boolean.json", + "tests": [ + { + "description": "Valid - true", + "data": true, + "valid": true + }, + { + "description": "Valid - false", + "data": false, + "valid": true + }, + { + "description": "Invalid - string true", + "data": "true", + "valid": false + }, + { + "description": "Invalid - string false", + "data": "false", + "valid": false + }, + { + "description": "Invalid - number 1", + "data": 1, + "valid": false + }, + { + "description": "Invalid - number 0", + "data": 0, + "valid": false + }, + { + "description": "Invalid - null", + "data": null, + "valid": false + }, + { + "description": "Invalid - empty string", + "data": "", + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/date-time.test.json b/test/w3c/xmlschema/2004/date-time.test.json new file mode 100644 index 0000000..55f920f --- /dev/null +++ b/test/w3c/xmlschema/2004/date-time.test.json @@ -0,0 +1,126 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/date-time.json", + "tests": [ + { + "description": "Valid - basic datetime", + "data": "2023-05-15T14:30:00", + "valid": true + }, + { + "description": "Valid - datetime with Z timezone", + "data": "2023-05-15T14:30:00Z", + "valid": true + }, + { + "description": "Valid - datetime with positive offset", + "data": "2023-05-15T14:30:00+05:30", + "valid": true + }, + { + "description": "Valid - datetime with negative offset", + "data": "2023-05-15T14:30:00-08:00", + "valid": true + }, + { + "description": "Valid - datetime with fractional seconds", + "data": "2023-05-15T14:30:00.123", + "valid": true + }, + { + "description": "Valid - datetime with fractional seconds and timezone", + "data": "2023-05-15T14:30:00.123456Z", + "valid": true + }, + { + "description": "Valid - midnight", + "data": "2023-05-15T00:00:00", + "valid": true + }, + { + "description": "Valid - end of day", + "data": "2023-05-15T23:59:59", + "valid": true + }, + { + "description": "Valid - leap second", + "data": "2023-12-31T23:59:60Z", + "valid": true + }, + { + "description": "Valid - negative year", + "data": "-0001-12-31T23:59:59", + "valid": true + }, + { + "description": "Valid - February 29 in leap year 2020", + "data": "2020-02-29T12:00:00", + "valid": true + }, + { + "description": "Valid - February 29 (leap year validation is consumer responsibility)", + "data": "2023-02-29T12:00:00", + "valid": true + }, + { + "description": "Invalid - year 0000 (not allowed in XML Schema 1.0)", + "data": "0000-01-01T00:00:00", + "valid": false + }, + { + "description": "Invalid - year 0000 with timezone", + "data": "0000-06-15T12:00:00Z", + "valid": false + }, + { + "description": "Invalid - negative year 0000", + "data": "-0000-12-31T23:59:59", + "valid": false + }, + { + "description": "Invalid - day 31 in 30-day month", + "data": "2023-04-31T12:00:00", + "valid": false + }, + { + "description": "Invalid - February 30", + "data": "2023-02-30T12:00:00", + "valid": false + }, + { + "description": "Invalid - hour 24", + "data": "2023-05-15T24:00:00", + "valid": false + }, + { + "description": "Invalid - minute 60", + "data": "2023-05-15T14:60:00", + "valid": false + }, + { + "description": "Invalid - second 61", + "data": "2023-05-15T14:30:61", + "valid": false + }, + { + "description": "Invalid - missing time separator T", + "data": "2023-05-15 14:30:00", + "valid": false + }, + { + "description": "Invalid - date only", + "data": "2023-05-15", + "valid": false + }, + { + "description": "Invalid - time only", + "data": "T14:30:00", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 1684162200, + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/date.test.json b/test/w3c/xmlschema/2004/date.test.json new file mode 100644 index 0000000..80d45a8 --- /dev/null +++ b/test/w3c/xmlschema/2004/date.test.json @@ -0,0 +1,121 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/date.json", + "tests": [ + { + "description": "Valid - basic date", + "data": "2023-05-15", + "valid": true + }, + { + "description": "Valid - date with Z timezone", + "data": "2023-05-15Z", + "valid": true + }, + { + "description": "Valid - date with positive offset", + "data": "2023-05-15+05:30", + "valid": true + }, + { + "description": "Valid - date with negative offset", + "data": "2023-05-15-08:00", + "valid": true + }, + { + "description": "Valid - January 1", + "data": "2023-01-01", + "valid": true + }, + { + "description": "Valid - December 31", + "data": "2023-12-31", + "valid": true + }, + { + "description": "Valid - February 29 in leap year 2020", + "data": "2020-02-29", + "valid": true + }, + { + "description": "Valid - February 29 (leap year validation is consumer responsibility)", + "data": "2023-02-29", + "valid": true + }, + { + "description": "Valid - negative year", + "data": "-0001-12-31", + "valid": true + }, + { + "description": "Valid - negative year with timezone", + "data": "-2023-05-15Z", + "valid": true + }, + { + "description": "Invalid - year 0000 (not allowed in XML Schema 1.0)", + "data": "0000-01-01", + "valid": false + }, + { + "description": "Invalid - year 0000 with timezone", + "data": "0000-06-15Z", + "valid": false + }, + { + "description": "Invalid - negative year 0000", + "data": "-0000-12-31", + "valid": false + }, + { + "description": "Invalid - February 30", + "data": "2023-02-30", + "valid": false + }, + { + "description": "Invalid - day 31 in 30-day month", + "data": "2023-04-31", + "valid": false + }, + { + "description": "Invalid - day 32", + "data": "2023-05-32", + "valid": false + }, + { + "description": "Invalid - month 13", + "data": "2023-13-01", + "valid": false + }, + { + "description": "Invalid - month 00", + "data": "2023-00-01", + "valid": false + }, + { + "description": "Invalid - day 00", + "data": "2023-05-00", + "valid": false + }, + { + "description": "Invalid - three digit year", + "data": "999-05-15", + "valid": false + }, + { + "description": "Invalid - five digit year", + "data": "10000-05-15", + "valid": false + }, + { + "description": "Invalid - with time component", + "data": "2023-05-15T14:30:00", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 20230515, + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/decimal.test.json b/test/w3c/xmlschema/2004/decimal.test.json new file mode 100644 index 0000000..01170a5 --- /dev/null +++ b/test/w3c/xmlschema/2004/decimal.test.json @@ -0,0 +1,361 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/decimal.json", + "tests": [ + { + "description": "Valid - positive integer", + "data": "123", + "valid": true + }, + { + "description": "Valid - negative integer", + "data": "-456", + "valid": true + }, + { + "description": "Valid - positive decimal", + "data": "123.45", + "valid": true + }, + { + "description": "Valid - negative decimal", + "data": "-123.45", + "valid": true + }, + { + "description": "Valid - zero", + "data": "0", + "valid": true + }, + { + "description": "Valid - zero with decimal", + "data": "0.0", + "valid": true + }, + { + "description": "Valid - explicit positive sign", + "data": "+123.45", + "valid": true + }, + { + "description": "Valid - many digits", + "data": "123456789012345678.901234567890", + "valid": true + }, + { + "description": "Invalid - no digits before decimal", + "data": ".123", + "valid": false + }, + { + "description": "Invalid - no digits after decimal", + "data": "123.", + "valid": false + }, + { + "description": "Invalid - scientific notation", + "data": "1.23E+10", + "valid": false + }, + { + "description": "Invalid - multiple decimal points", + "data": "123.45.67", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 123.45, + "valid": false + }, + { + "description": "Invalid - empty string", + "data": "", + "valid": false + }, + { + "description": "Invalid - text", + "data": "abc", + "valid": false + }, + { + "description": "Valid - leading zeros integer", + "data": "007", + "valid": true + }, + { + "description": "Valid - leading zeros decimal", + "data": "000.123", + "valid": true + }, + { + "description": "Valid - all zeros", + "data": "0000000", + "valid": true + }, + { + "description": "Valid - single digit", + "data": "5", + "valid": true + }, + { + "description": "Valid - trailing zeros after decimal", + "data": "123.000", + "valid": true + }, + { + "description": "Valid - many decimal places", + "data": "1.1234567890123456789", + "valid": true + }, + { + "description": "Valid - negative zero", + "data": "-0", + "valid": true + }, + { + "description": "Valid - positive zero with sign", + "data": "+0", + "valid": true + }, + { + "description": "Valid - negative zero with decimal", + "data": "-0.0", + "valid": true + }, + { + "description": "Valid - only zero before decimal", + "data": "0.1", + "valid": true + }, + { + "description": "Valid - single zero after decimal", + "data": "1.0", + "valid": true + }, + { + "description": "Valid - leading zeros with sign", + "data": "+0007.89", + "valid": true + }, + { + "description": "Valid - negative leading zeros", + "data": "-000123", + "valid": true + }, + { + "description": "Invalid - just plus sign", + "data": "+", + "valid": false + }, + { + "description": "Invalid - just minus sign", + "data": "-", + "valid": false + }, + { + "description": "Invalid - double plus", + "data": "++5", + "valid": false + }, + { + "description": "Invalid - double minus", + "data": "--5", + "valid": false + }, + { + "description": "Invalid - plus then minus", + "data": "+-5", + "valid": false + }, + { + "description": "Invalid - minus then plus", + "data": "-+5", + "valid": false + }, + { + "description": "Invalid - sign in middle", + "data": "12-34", + "valid": false + }, + { + "description": "Invalid - plus in middle", + "data": "12+34", + "valid": false + }, + { + "description": "Invalid - sign at end", + "data": "123-", + "valid": false + }, + { + "description": "Invalid - plus at end", + "data": "123+", + "valid": false + }, + { + "description": "Invalid - leading space", + "data": " 123", + "valid": false + }, + { + "description": "Invalid - trailing space", + "data": "123 ", + "valid": false + }, + { + "description": "Invalid - space in middle", + "data": "12 3", + "valid": false + }, + { + "description": "Invalid - space around decimal", + "data": "12 . 34", + "valid": false + }, + { + "description": "Invalid - only decimal point", + "data": ".", + "valid": false + }, + { + "description": "Invalid - double decimal consecutive", + "data": "12..34", + "valid": false + }, + { + "description": "Invalid - leading decimal with plus", + "data": "+.5", + "valid": false + }, + { + "description": "Invalid - leading decimal with minus", + "data": "-.5", + "valid": false + }, + { + "description": "Invalid - trailing decimal with plus", + "data": "+5.", + "valid": false + }, + { + "description": "Invalid - trailing decimal with minus", + "data": "-5.", + "valid": false + }, + { + "description": "Invalid - letter in number", + "data": "12a34", + "valid": false + }, + { + "description": "Invalid - lowercase e notation", + "data": "1.2e3", + "valid": false + }, + { + "description": "Invalid - uppercase E notation", + "data": "1.2E3", + "valid": false + }, + { + "description": "Invalid - comma separator", + "data": "1,234.56", + "valid": false + }, + { + "description": "Invalid - underscore separator", + "data": "1_234.56", + "valid": false + }, + { + "description": "Invalid - dollar sign", + "data": "$123", + "valid": false + }, + { + "description": "Invalid - tab character", + "data": "\t123", + "valid": false + }, + { + "description": "Invalid - multiple numbers with space", + "data": "123 456", + "valid": false + }, + { + "description": "Invalid - parentheses", + "data": "(123)", + "valid": false + }, + { + "description": "Invalid - negative with parentheses", + "data": "-(123)", + "valid": false + }, + { + "description": "Invalid - slash", + "data": "123/456", + "valid": false + }, + { + "description": "Invalid - colon", + "data": "123:456", + "valid": false + }, + { + "description": "Invalid - semicolon", + "data": "123;456", + "valid": false + }, + { + "description": "Invalid - hash", + "data": "#123", + "valid": false + }, + { + "description": "Invalid - percent", + "data": "123%", + "valid": false + }, + { + "description": "Invalid - ampersand", + "data": "123&456", + "valid": false + }, + { + "description": "Invalid - asterisk", + "data": "123*456", + "valid": false + }, + { + "description": "Invalid - caret", + "data": "123^456", + "valid": false + }, + { + "description": "Invalid - three consecutive decimals", + "data": "1...2", + "valid": false + }, + { + "description": "Invalid - decimal before sign", + "data": ".+5", + "valid": false + }, + { + "description": "Invalid - mixed valid and invalid", + "data": "123.45abc", + "valid": false + }, + { + "description": "Invalid - trailing letters", + "data": "123xyz", + "valid": false + }, + { + "description": "Invalid - leading letters", + "data": "xyz123", + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/double.test.json b/test/w3c/xmlschema/2004/double.test.json new file mode 100644 index 0000000..27a2ed9 --- /dev/null +++ b/test/w3c/xmlschema/2004/double.test.json @@ -0,0 +1,96 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/double.json", + "tests": [ + { + "description": "Valid - positive double", + "data": 3.14159, + "valid": true + }, + { + "description": "Valid - negative double", + "data": -2.71828, + "valid": true + }, + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - negative zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - integer", + "data": 42, + "valid": true + }, + { + "description": "Valid - very large number", + "data": 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "valid": true + }, + { + "description": "Valid - very small number", + "data": 2.23e-308, + "valid": true + }, + { + "description": "Valid - positive infinity", + "data": "INF", + "valid": true + }, + { + "description": "Valid - negative infinity", + "data": "-INF", + "valid": true + }, + { + "description": "Valid - not a number", + "data": "NaN", + "valid": true + }, + { + "description": "Invalid - IEEE 754-2019 positive infinity", + "data": "+Inf", + "valid": false + }, + { + "description": "Invalid - IEEE 754-2019 negative infinity", + "data": "-Inf", + "valid": false + }, + { + "description": "Invalid - C23 INFINITY", + "data": "INFINITY", + "valid": false + }, + { + "description": "Invalid - C23 -INFINITY", + "data": "-INFINITY", + "valid": false + }, + { + "description": "Invalid - C23 NAN", + "data": "NAN", + "valid": false + }, + { + "description": "Invalid - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid - null", + "data": null, + "valid": false + }, + { + "description": "Invalid - string number", + "data": "123.45", + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/duration.test.json b/test/w3c/xmlschema/2004/duration.test.json new file mode 100644 index 0000000..f55c4dd --- /dev/null +++ b/test/w3c/xmlschema/2004/duration.test.json @@ -0,0 +1,101 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/duration.json", + "tests": [ + { + "description": "Valid - years only", + "data": "P1Y", + "valid": true + }, + { + "description": "Valid - months only", + "data": "P6M", + "valid": true + }, + { + "description": "Valid - days only", + "data": "P100D", + "valid": true + }, + { + "description": "Valid - hours only", + "data": "PT5H", + "valid": true + }, + { + "description": "Valid - minutes only", + "data": "PT30M", + "valid": true + }, + { + "description": "Valid - seconds only", + "data": "PT45S", + "valid": true + }, + { + "description": "Valid - full date and time", + "data": "P1Y2M3DT4H5M6S", + "valid": true + }, + { + "description": "Valid - decimal seconds", + "data": "PT1.5S", + "valid": true + }, + { + "description": "Valid - negative duration years", + "data": "-P1Y", + "valid": true + }, + { + "description": "Valid - negative duration full", + "data": "-P1Y2M3DT4H5M6S", + "valid": true + }, + { + "description": "Valid - negative duration with decimal", + "data": "-PT30.5M", + "valid": true + }, + { + "description": "Invalid - empty P", + "data": "P", + "valid": false + }, + { + "description": "Invalid - empty PT", + "data": "PT", + "valid": false + }, + { + "description": "Invalid - empty -P", + "data": "-P", + "valid": false + }, + { + "description": "Invalid - empty -PT", + "data": "-PT", + "valid": false + }, + { + "description": "Invalid - missing P", + "data": "1Y2M3D", + "valid": false + }, + { + "description": "Invalid - missing T for time", + "data": "P1Y2M3D4H5M6S", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 100, + "valid": false + }, + { + "description": "Invalid - empty string", + "data": "", + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/float.test.json b/test/w3c/xmlschema/2004/float.test.json new file mode 100644 index 0000000..7b83c84 --- /dev/null +++ b/test/w3c/xmlschema/2004/float.test.json @@ -0,0 +1,86 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/float.json", + "tests": [ + { + "description": "Valid - positive float", + "data": 3.14, + "valid": true + }, + { + "description": "Valid - negative float", + "data": -2.718, + "valid": true + }, + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - negative zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - integer", + "data": 42, + "valid": true + }, + { + "description": "Valid - positive infinity", + "data": "INF", + "valid": true + }, + { + "description": "Valid - negative infinity", + "data": "-INF", + "valid": true + }, + { + "description": "Valid - not a number", + "data": "NaN", + "valid": true + }, + { + "description": "Invalid - IEEE 754-2019 positive infinity", + "data": "+Inf", + "valid": false + }, + { + "description": "Invalid - IEEE 754-2019 negative infinity", + "data": "-Inf", + "valid": false + }, + { + "description": "Invalid - C23 INFINITY", + "data": "INFINITY", + "valid": false + }, + { + "description": "Invalid - C23 -INFINITY", + "data": "-INFINITY", + "valid": false + }, + { + "description": "Invalid - C23 NAN", + "data": "NAN", + "valid": false + }, + { + "description": "Invalid - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid - null", + "data": null, + "valid": false + }, + { + "description": "Invalid - string number", + "data": "123.45", + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/g-day.test.json b/test/w3c/xmlschema/2004/g-day.test.json new file mode 100644 index 0000000..165e500 --- /dev/null +++ b/test/w3c/xmlschema/2004/g-day.test.json @@ -0,0 +1,76 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/g-day.json", + "tests": [ + { + "description": "Valid - basic day", + "data": "---15", + "valid": true + }, + { + "description": "Valid - day with Z timezone", + "data": "---15Z", + "valid": true + }, + { + "description": "Valid - day with positive offset", + "data": "---15+05:30", + "valid": true + }, + { + "description": "Valid - day with negative offset", + "data": "---15-08:00", + "valid": true + }, + { + "description": "Valid - day 01", + "data": "---01", + "valid": true + }, + { + "description": "Valid - day 31", + "data": "---31", + "valid": true + }, + { + "description": "Invalid - day 00", + "data": "---00", + "valid": false + }, + { + "description": "Invalid - day 32", + "data": "---32", + "valid": false + }, + { + "description": "Invalid - single digit day", + "data": "---5", + "valid": false + }, + { + "description": "Invalid - two dashes", + "data": "--15", + "valid": false + }, + { + "description": "Invalid - four dashes", + "data": "----15", + "valid": false + }, + { + "description": "Invalid - with month", + "data": "---05-15", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 15, + "valid": false + }, + { + "description": "Invalid - empty string", + "data": "", + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/g-month-day.test.json b/test/w3c/xmlschema/2004/g-month-day.test.json new file mode 100644 index 0000000..625a0a1 --- /dev/null +++ b/test/w3c/xmlschema/2004/g-month-day.test.json @@ -0,0 +1,96 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/g-month-day.json", + "tests": [ + { + "description": "Valid - basic month-day", + "data": "--05-15", + "valid": true + }, + { + "description": "Valid - month-day with Z timezone", + "data": "--05-15Z", + "valid": true + }, + { + "description": "Valid - month-day with positive offset", + "data": "--05-15+05:30", + "valid": true + }, + { + "description": "Valid - month-day with negative offset", + "data": "--05-15-08:00", + "valid": true + }, + { + "description": "Valid - January 1", + "data": "--01-01", + "valid": true + }, + { + "description": "Valid - December 31", + "data": "--12-31", + "valid": true + }, + { + "description": "Valid - February 29", + "data": "--02-29", + "valid": true + }, + { + "description": "Valid - April 30", + "data": "--04-30", + "valid": true + }, + { + "description": "Invalid - February 30", + "data": "--02-30", + "valid": false + }, + { + "description": "Invalid - April 31", + "data": "--04-31", + "valid": false + }, + { + "description": "Invalid - day 32", + "data": "--05-32", + "valid": false + }, + { + "description": "Invalid - month 13", + "data": "--13-01", + "valid": false + }, + { + "description": "Invalid - month 00", + "data": "--00-01", + "valid": false + }, + { + "description": "Invalid - day 00", + "data": "--05-00", + "valid": false + }, + { + "description": "Invalid - single dash prefix", + "data": "-05-15", + "valid": false + }, + { + "description": "Invalid - triple dash prefix", + "data": "---05-15", + "valid": false + }, + { + "description": "Invalid - with year", + "data": "--2023-05-15", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 515, + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/g-month.test.json b/test/w3c/xmlschema/2004/g-month.test.json new file mode 100644 index 0000000..7fc2b50 --- /dev/null +++ b/test/w3c/xmlschema/2004/g-month.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/g-month.json", + "tests": [ + { + "description": "Valid - basic month", + "data": "--05", + "valid": true + }, + { + "description": "Valid - month with Z timezone", + "data": "--05Z", + "valid": true + }, + { + "description": "Valid - month with positive offset", + "data": "--05+05:30", + "valid": true + }, + { + "description": "Valid - month with negative offset", + "data": "--05-08:00", + "valid": true + }, + { + "description": "Valid - January", + "data": "--01", + "valid": true + }, + { + "description": "Valid - December", + "data": "--12", + "valid": true + }, + { + "description": "Invalid - month 00", + "data": "--00", + "valid": false + }, + { + "description": "Invalid - month 13", + "data": "--13", + "valid": false + }, + { + "description": "Invalid - single digit month", + "data": "--5", + "valid": false + }, + { + "description": "Invalid - single dash", + "data": "-05", + "valid": false + }, + { + "description": "Invalid - triple dash", + "data": "---05", + "valid": false + }, + { + "description": "Invalid - with day", + "data": "--05-15", + "valid": false + }, + { + "description": "Invalid - with year", + "data": "2023--05", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 5, + "valid": false + }, + { + "description": "Invalid - empty string", + "data": "", + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/g-year-month.test.json b/test/w3c/xmlschema/2004/g-year-month.test.json new file mode 100644 index 0000000..b170270 --- /dev/null +++ b/test/w3c/xmlschema/2004/g-year-month.test.json @@ -0,0 +1,96 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/g-year-month.json", + "tests": [ + { + "description": "Valid - basic year-month", + "data": "2023-05", + "valid": true + }, + { + "description": "Valid - year-month with Z timezone", + "data": "2023-05Z", + "valid": true + }, + { + "description": "Valid - year-month with positive offset", + "data": "2023-05+05:30", + "valid": true + }, + { + "description": "Valid - year-month with negative offset", + "data": "2023-05-08:00", + "valid": true + }, + { + "description": "Valid - January", + "data": "2023-01", + "valid": true + }, + { + "description": "Valid - December", + "data": "2023-12", + "valid": true + }, + { + "description": "Valid - negative year", + "data": "-0001-12", + "valid": true + }, + { + "description": "Valid - negative year with timezone", + "data": "-2023-05Z", + "valid": true + }, + { + "description": "Invalid - year 0000 (not allowed in XML Schema 1.0)", + "data": "0000-01", + "valid": false + }, + { + "description": "Invalid - year 0000 with timezone", + "data": "0000-05Z", + "valid": false + }, + { + "description": "Invalid - negative year 0000", + "data": "-0000-12", + "valid": false + }, + { + "description": "Invalid - month 13", + "data": "2023-13", + "valid": false + }, + { + "description": "Invalid - month 00", + "data": "2023-00", + "valid": false + }, + { + "description": "Invalid - three digit year", + "data": "999-05", + "valid": false + }, + { + "description": "Invalid - five digit year", + "data": "10000-05", + "valid": false + }, + { + "description": "Invalid - with day component", + "data": "2023-05-15", + "valid": false + }, + { + "description": "Invalid - single digit month", + "data": "2023-5", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 202305, + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/g-year.test.json b/test/w3c/xmlschema/2004/g-year.test.json new file mode 100644 index 0000000..0e04657 --- /dev/null +++ b/test/w3c/xmlschema/2004/g-year.test.json @@ -0,0 +1,86 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/g-year.json", + "tests": [ + { + "description": "Valid - basic year", + "data": "2023", + "valid": true + }, + { + "description": "Valid - year with Z timezone", + "data": "2023Z", + "valid": true + }, + { + "description": "Valid - year with positive offset", + "data": "2023+05:30", + "valid": true + }, + { + "description": "Valid - year with negative offset", + "data": "2023-08:00", + "valid": true + }, + { + "description": "Valid - year 9999", + "data": "9999", + "valid": true + }, + { + "description": "Invalid - year 0000 (not allowed in XML Schema 1.0)", + "data": "0000", + "valid": false + }, + { + "description": "Invalid - year 0000 with timezone", + "data": "0000Z", + "valid": false + }, + { + "description": "Invalid - negative year 0000", + "data": "-0000", + "valid": false + }, + { + "description": "Valid - negative year", + "data": "-0001", + "valid": true + }, + { + "description": "Valid - negative year with timezone", + "data": "-2023Z", + "valid": true + }, + { + "description": "Invalid - three digit year", + "data": "999", + "valid": false + }, + { + "description": "Invalid - five digit year", + "data": "10000", + "valid": false + }, + { + "description": "Invalid - with month component", + "data": "2023-05", + "valid": false + }, + { + "description": "Invalid - with full date", + "data": "2023-05-15", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 2023, + "valid": false + }, + { + "description": "Invalid - empty string", + "data": "", + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/hex-binary.test.json b/test/w3c/xmlschema/2004/hex-binary.test.json new file mode 100644 index 0000000..4fe3eee --- /dev/null +++ b/test/w3c/xmlschema/2004/hex-binary.test.json @@ -0,0 +1,501 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/hex-binary.json", + "tests": [ + { + "description": "Valid - empty string", + "data": "", + "valid": true + }, + { + "description": "Valid - single byte lowercase", + "data": "0f", + "valid": true + }, + { + "description": "Valid - single byte uppercase", + "data": "0F", + "valid": true + }, + { + "description": "Valid - single byte mixed case", + "data": "0F", + "valid": true + }, + { + "description": "Valid - two bytes", + "data": "0FB7", + "valid": true + }, + { + "description": "Valid - all lowercase", + "data": "deadbeef", + "valid": true + }, + { + "description": "Valid - all uppercase", + "data": "DEADBEEF", + "valid": true + }, + { + "description": "Valid - mixed case", + "data": "DeAdBeEf", + "valid": true + }, + { + "description": "Valid - all hex digits lowercase", + "data": "0123456789abcdef", + "valid": true + }, + { + "description": "Valid - all hex digits uppercase", + "data": "0123456789ABCDEF", + "valid": true + }, + { + "description": "Valid - many bytes", + "data": "0123456789ABCDEF0123456789ABCDEF", + "valid": true + }, + { + "description": "Valid - zeros", + "data": "0000", + "valid": true + }, + { + "description": "Valid - FFs", + "data": "FFFF", + "valid": true + }, + { + "description": "Invalid - odd number of digits", + "data": "0FB", + "valid": false + }, + { + "description": "Invalid - single digit", + "data": "F", + "valid": false + }, + { + "description": "Invalid - three digits", + "data": "ABC", + "valid": false + }, + { + "description": "Invalid - contains G", + "data": "0G", + "valid": false + }, + { + "description": "Invalid - contains Z", + "data": "0Z", + "valid": false + }, + { + "description": "Invalid - contains space", + "data": "0F B7", + "valid": false + }, + { + "description": "Invalid - contains dash", + "data": "0F-B7", + "valid": false + }, + { + "description": "Invalid - contains colon", + "data": "0F:B7", + "valid": false + }, + { + "description": "Invalid - leading space", + "data": " 0FB7", + "valid": false + }, + { + "description": "Invalid - trailing space", + "data": "0FB7 ", + "valid": false + }, + { + "description": "Invalid - contains lowercase g", + "data": "0g", + "valid": false + }, + { + "description": "Invalid - contains non-hex letter", + "data": "HELLO", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 123, + "valid": false + }, + { + "description": "Invalid - boolean type", + "data": true, + "valid": false + }, + { + "description": "Invalid - null type", + "data": null, + "valid": false + }, + { + "description": "Invalid - contains special chars", + "data": "0F@B", + "valid": false + }, + { + "description": "Invalid - contains plus", + "data": "0F+B7", + "valid": false + }, + { + "description": "Invalid - contains slash", + "data": "0F/B7", + "valid": false + }, + { + "description": "Invalid - contains equals", + "data": "0F=B7", + "valid": false + }, + { + "description": "Valid - 4 bytes", + "data": "ABCD1234", + "valid": true + }, + { + "description": "Valid - 8 bytes", + "data": "0123456789ABCDEF", + "valid": true + }, + { + "description": "Valid - 16 bytes", + "data": "0123456789ABCDEF0123456789ABCDEF", + "valid": true + }, + { + "description": "Valid - 32 bytes", + "data": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", + "valid": true + }, + { + "description": "Valid - all F uppercase", + "data": "FFFFFFFF", + "valid": true + }, + { + "description": "Valid - all f lowercase", + "data": "ffffffff", + "valid": true + }, + { + "description": "Valid - all zeros", + "data": "00000000", + "valid": true + }, + { + "description": "Valid - alternating hex digits", + "data": "0A0B0C0D", + "valid": true + }, + { + "description": "Valid - sequential hex", + "data": "0123456789ABCDEF", + "valid": true + }, + { + "description": "Valid - mixed case sequential", + "data": "0123456789AbCdEf", + "valid": true + }, + { + "description": "Valid - lowercase sequential", + "data": "0123456789abcdef", + "valid": true + }, + { + "description": "Valid - only digits", + "data": "01234567", + "valid": true + }, + { + "description": "Valid - only uppercase letters", + "data": "ABCDEF", + "valid": true + }, + { + "description": "Valid - only lowercase letters", + "data": "abcdef", + "valid": true + }, + { + "description": "Valid - start with 0", + "data": "00AB", + "valid": true + }, + { + "description": "Valid - start with F", + "data": "FFAB", + "valid": true + }, + { + "description": "Valid - end with 0", + "data": "AB00", + "valid": true + }, + { + "description": "Valid - end with F", + "data": "ABFF", + "valid": true + }, + { + "description": "Valid - repeated pattern", + "data": "ABABABAB", + "valid": true + }, + { + "description": "Valid - all same byte", + "data": "AAAAAAAA", + "valid": true + }, + { + "description": "Invalid - single 0", + "data": "0", + "valid": false + }, + { + "description": "Invalid - single A", + "data": "A", + "valid": false + }, + { + "description": "Invalid - three chars", + "data": "0AB", + "valid": false + }, + { + "description": "Invalid - five chars", + "data": "0ABCD", + "valid": false + }, + { + "description": "Invalid - seven chars", + "data": "0ABCDEF", + "valid": false + }, + { + "description": "Invalid - nine chars", + "data": "0ABCDEF12", + "valid": false + }, + { + "description": "Invalid - eleven chars", + "data": "0ABCDEF1234", + "valid": false + }, + { + "description": "Invalid - G at start", + "data": "G0AB", + "valid": false + }, + { + "description": "Invalid - G at end", + "data": "AB0G", + "valid": false + }, + { + "description": "Invalid - G in middle", + "data": "0GBC", + "valid": false + }, + { + "description": "Invalid - lowercase g at start", + "data": "g0ab", + "valid": false + }, + { + "description": "Invalid - H", + "data": "0HAB", + "valid": false + }, + { + "description": "Invalid - I", + "data": "0IAB", + "valid": false + }, + { + "description": "Invalid - J", + "data": "0JAB", + "valid": false + }, + { + "description": "Invalid - Z", + "data": "0ZAB", + "valid": false + }, + { + "description": "Invalid - lowercase h", + "data": "0hab", + "valid": false + }, + { + "description": "Invalid - lowercase z", + "data": "0zab", + "valid": false + }, + { + "description": "Invalid - contains .", + "data": "0A.B", + "valid": false + }, + { + "description": "Invalid - contains ,", + "data": "0A,BC", + "valid": false + }, + { + "description": "Invalid - contains ;", + "data": "0A;B", + "valid": false + }, + { + "description": "Invalid - contains !", + "data": "0A!B", + "valid": false + }, + { + "description": "Invalid - contains ?", + "data": "0A?B", + "valid": false + }, + { + "description": "Invalid - contains @", + "data": "0A@B", + "valid": false + }, + { + "description": "Invalid - contains #", + "data": "0A#B", + "valid": false + }, + { + "description": "Invalid - contains $", + "data": "0A$B", + "valid": false + }, + { + "description": "Invalid - contains %", + "data": "0A%B", + "valid": false + }, + { + "description": "Invalid - contains &", + "data": "0A&B", + "valid": false + }, + { + "description": "Invalid - contains *", + "data": "0A*B", + "valid": false + }, + { + "description": "Invalid - contains (", + "data": "0A(B", + "valid": false + }, + { + "description": "Invalid - contains )", + "data": "0A)B", + "valid": false + }, + { + "description": "Invalid - contains [", + "data": "0A[B", + "valid": false + }, + { + "description": "Invalid - contains ]", + "data": "0A]B", + "valid": false + }, + { + "description": "Invalid - contains {", + "data": "0A{B", + "valid": false + }, + { + "description": "Invalid - contains }", + "data": "0A}B", + "valid": false + }, + { + "description": "Invalid - contains |", + "data": "0A|B", + "valid": false + }, + { + "description": "Invalid - contains \\", + "data": "0A\\B", + "valid": false + }, + { + "description": "Invalid - contains ~", + "data": "0A~B", + "valid": false + }, + { + "description": "Invalid - contains `", + "data": "0A`B", + "valid": false + }, + { + "description": "Invalid - contains ^", + "data": "0A^B", + "valid": false + }, + { + "description": "Invalid - contains <", + "data": "0A", + "data": "0A>B", + "valid": false + }, + { + "description": "Invalid - contains tab", + "data": "0A\tBC", + "valid": false + }, + { + "description": "Invalid - contains carriage return", + "data": "0A\rBC", + "valid": false + }, + { + "description": "Invalid - non-ASCII", + "data": "0Aé", + "valid": false + }, + { + "description": "Invalid - emoji", + "data": "0A😀", + "valid": false + }, + { + "description": "Invalid - underscore", + "data": "0A_B", + "valid": false + }, + { + "description": "Invalid - equals mixed in", + "data": "0A=B", + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/string.test.json b/test/w3c/xmlschema/2004/string.test.json new file mode 100644 index 0000000..1259e2a --- /dev/null +++ b/test/w3c/xmlschema/2004/string.test.json @@ -0,0 +1,56 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/string.json", + "tests": [ + { + "description": "Valid - simple string", + "data": "hello world", + "valid": true + }, + { + "description": "Valid - empty string", + "data": "", + "valid": true + }, + { + "description": "Valid - string with special characters", + "data": "Hello, 世界! @#$%^&*()", + "valid": true + }, + { + "description": "Valid - string with whitespace", + "data": " spaces and\ttabs\nand newlines ", + "valid": true + }, + { + "description": "Valid - numeric string", + "data": "12345", + "valid": true + }, + { + "description": "Invalid - number type", + "data": 123, + "valid": false + }, + { + "description": "Invalid - boolean type", + "data": true, + "valid": false + }, + { + "description": "Invalid - null type", + "data": null, + "valid": false + }, + { + "description": "Invalid - object type", + "data": {}, + "valid": false + }, + { + "description": "Invalid - array type", + "data": [], + "valid": false + } + ] +} diff --git a/test/w3c/xmlschema/2004/time.test.json b/test/w3c/xmlschema/2004/time.test.json new file mode 100644 index 0000000..89ca114 --- /dev/null +++ b/test/w3c/xmlschema/2004/time.test.json @@ -0,0 +1,101 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/w3c/xmlschema/2004/time.json", + "tests": [ + { + "description": "Valid - basic time", + "data": "14:30:00", + "valid": true + }, + { + "description": "Valid - time with Z timezone", + "data": "14:30:00Z", + "valid": true + }, + { + "description": "Valid - time with positive offset", + "data": "14:30:00+05:30", + "valid": true + }, + { + "description": "Valid - time with negative offset", + "data": "14:30:00-08:00", + "valid": true + }, + { + "description": "Valid - time with fractional seconds", + "data": "14:30:00.123", + "valid": true + }, + { + "description": "Valid - time with fractional seconds and timezone", + "data": "14:30:00.123456Z", + "valid": true + }, + { + "description": "Valid - midnight", + "data": "00:00:00", + "valid": true + }, + { + "description": "Valid - end of day", + "data": "23:59:59", + "valid": true + }, + { + "description": "Valid - 24:00:00", + "data": "24:00:00", + "valid": true + }, + { + "description": "Valid - leap second", + "data": "23:59:60", + "valid": true + }, + { + "description": "Invalid - hour 25", + "data": "25:00:00", + "valid": false + }, + { + "description": "Invalid - minute 60", + "data": "14:60:00", + "valid": false + }, + { + "description": "Invalid - second 61", + "data": "14:30:61", + "valid": false + }, + { + "description": "Invalid - 24:00:01", + "data": "24:00:01", + "valid": false + }, + { + "description": "Invalid - 24:01:00", + "data": "24:01:00", + "valid": false + }, + { + "description": "Invalid - missing seconds", + "data": "14:30", + "valid": false + }, + { + "description": "Invalid - single digit hour", + "data": "9:30:00", + "valid": false + }, + { + "description": "Invalid - number type", + "data": 143000, + "valid": false + }, + { + "description": "Invalid - empty string", + "data": "", + "valid": false + } + ] +}