diff --git a/README.markdown b/README.markdown index 908671d..ac415d3 100644 --- a/README.markdown +++ b/README.markdown @@ -66,6 +66,7 @@ expressed as JSON Schema definitions. | ISO | [ISO 8601-1:2019](https://www.iso.org/standard/70907.html) | Date and time — Representations for information interchange — Part 1: Basic rules | | ISO | [ISO 80000-1:2022](https://www.iso.org/standard/76921.html) | Quantities and units — Part 1: General | | ISO/IEC | [ISO/IEC 2382:2015](https://www.iso.org/standard/63598.html) | Information technology — Vocabulary | +| 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 | diff --git a/schemas/iso/c/2024/bool.json b/schemas/iso/c/2024/bool.json new file mode 100644 index 0000000..7279d96 --- /dev/null +++ b/schemas/iso/c/2024/bool.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Boolean Type (bool)", + "description": "A boolean type that can hold the values 0 (false) or 1 (true)", + "$comment": "In C, bool is represented as an integer type that can only hold 0 or 1. Defined in `` as `_Bool`", + "examples": [ 0, 1 ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "enum": [ 0, 1 ] +} diff --git a/schemas/iso/c/2024/double.json b/schemas/iso/c/2024/double.json new file mode 100644 index 0000000..0404662 --- /dev/null +++ b/schemas/iso/c/2024/double.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Double Precision Floating Point (double)", + "description": "A double precision (64-bit) floating point type conforming to IEC 60559 (IEEE 754)", + "$comment": "The minimum and maximum represent `DBL_MAX` and `-DBL_MAX`. Special floating-point values are defined in a separate schema", + "examples": [ + 0.0, + 1.5, + -3.14159, + 299800000.0, + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "NAN", + "INFINITY", + "-INFINITY" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "anyOf": [ + { + "type": "number", + "maximum": 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "minimum": -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0 + }, + { + "$ref": "./float-special.json" + } + ] +} diff --git a/schemas/iso/c/2024/float-special.json b/schemas/iso/c/2024/float-special.json new file mode 100644 index 0000000..0f731e1 --- /dev/null +++ b/schemas/iso/c/2024/float-special.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Special Floating-Point Values", + "description": "Special floating-point values as defined in ``. These are represented as strings since JSON numbers cannot express these values", + "examples": [ "NAN", "INFINITY", "-INFINITY" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "enum": [ "NAN", "INFINITY", "-INFINITY" ] +} diff --git a/schemas/iso/c/2024/float.json b/schemas/iso/c/2024/float.json new file mode 100644 index 0000000..2789f12 --- /dev/null +++ b/schemas/iso/c/2024/float.json @@ -0,0 +1,28 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Single Precision Floating Point (float)", + "description": "A single precision (32-bit) floating point type conforming to IEC 60559 (IEEE 754)", + "$comment": "The minimum and maximum represent `FLT_MAX` and `-FLT_MAX`. Special floating-point values are defined in a separate schema", + "examples": [ + 0.0, + 1.5, + -3.14, + 340282346600000016151267322115014000640.0, + -340282346600000016151267322115014000640.0, + "NAN", + "INFINITY", + "-INFINITY" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "anyOf": [ + { + "type": "number", + "maximum": 340282346600000016151267322115014000640.0, + "minimum": -340282346600000016151267322115014000640.0 + }, + { + "$ref": "./float-special.json" + } + ] +} diff --git a/schemas/iso/c/2024/int16_t.json b/schemas/iso/c/2024/int16_t.json new file mode 100644 index 0000000..356f846 --- /dev/null +++ b/schemas/iso/c/2024/int16_t.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Signed 16-bit Integer (int16_t)", + "description": "A signed integer type with width of exactly 16 bits", + "examples": [ 0, 1, -1, 32767, -32768, 1000, -1000 ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "type": "integer", + "maximum": 32767, + "minimum": -32768 +} diff --git a/schemas/iso/c/2024/int32_t.json b/schemas/iso/c/2024/int32_t.json new file mode 100644 index 0000000..31a8651 --- /dev/null +++ b/schemas/iso/c/2024/int32_t.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Signed 32-bit Integer (int32_t)", + "description": "A signed integer type with width of exactly 32 bits", + "examples": [ 0, 1, -1, 2147483647, -2147483648, 42, -999 ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "type": "integer", + "maximum": 2147483647, + "minimum": -2147483648 +} diff --git a/schemas/iso/c/2024/int64_t.json b/schemas/iso/c/2024/int64_t.json new file mode 100644 index 0000000..6d7bf22 --- /dev/null +++ b/schemas/iso/c/2024/int64_t.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Signed 64-bit Integer (int64_t)", + "description": "A signed integer type with width of exactly 64 bits", + "examples": [ + 0, + 1, + -1, + 9223372036854775807, + -9223372036854775808, + 1000000000, + -1000000000 + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "type": "integer", + "maximum": 9223372036854775807, + "minimum": -9223372036854775808 +} diff --git a/schemas/iso/c/2024/int8_t.json b/schemas/iso/c/2024/int8_t.json new file mode 100644 index 0000000..a3f3c25 --- /dev/null +++ b/schemas/iso/c/2024/int8_t.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Signed 8-bit Integer (int8_t)", + "description": "A signed integer type with width of exactly 8 bits", + "examples": [ 0, 1, -1, 127, -128, 42, -99 ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "type": "integer", + "maximum": 127, + "minimum": -128 +} diff --git a/schemas/iso/c/2024/uint16_t.json b/schemas/iso/c/2024/uint16_t.json new file mode 100644 index 0000000..beb2d12 --- /dev/null +++ b/schemas/iso/c/2024/uint16_t.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Unsigned 16-bit Integer (uint16_t)", + "description": "An unsigned integer type with width of exactly 16 bits", + "examples": [ 0, 1, 65535, 32768, 1000 ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "type": "integer", + "maximum": 65535, + "minimum": 0 +} diff --git a/schemas/iso/c/2024/uint32_t.json b/schemas/iso/c/2024/uint32_t.json new file mode 100644 index 0000000..ddc50aa --- /dev/null +++ b/schemas/iso/c/2024/uint32_t.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Unsigned 32-bit Integer (uint32_t)", + "description": "An unsigned integer type with width of exactly 32 bits", + "examples": [ 0, 1, 4294967295, 2147483648, 42 ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "type": "integer", + "maximum": 4294967295, + "minimum": 0 +} diff --git a/schemas/iso/c/2024/uint8_t.json b/schemas/iso/c/2024/uint8_t.json new file mode 100644 index 0000000..9317553 --- /dev/null +++ b/schemas/iso/c/2024/uint8_t.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "ISO/IEC 9899:2024 Unsigned 8-bit Integer (uint8_t)", + "description": "An unsigned integer type with width of exactly 8 bits", + "examples": [ 0, 1, 255, 128, 42 ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://www.iso.org/standard/82075.html" ], + "type": "integer", + "maximum": 255, + "minimum": 0 +} diff --git a/test/iso/c/2024/bool.test.json b/test/iso/c/2024/bool.test.json new file mode 100644 index 0000000..853b98c --- /dev/null +++ b/test/iso/c/2024/bool.test.json @@ -0,0 +1,61 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/bool.json", + "tests": [ + { + "description": "Valid - 0 (false)", + "data": 0, + "valid": true + }, + { + "description": "Valid - 1 (true)", + "data": 1, + "valid": true + }, + { + "description": "Invalid - 2", + "data": 2, + "valid": false + }, + { + "description": "Invalid - negative number", + "data": -1, + "valid": false + }, + { + "description": "Invalid - large positive number", + "data": 100, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "true", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Invalid type - float", + "data": 0.5, + "valid": false + } + ] +} diff --git a/test/iso/c/2024/double.test.json b/test/iso/c/2024/double.test.json new file mode 100644 index 0000000..f83ab73 --- /dev/null +++ b/test/iso/c/2024/double.test.json @@ -0,0 +1,116 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/double.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1.5, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -3.14159, + "valid": true + }, + { + "description": "Valid - scientific notation", + "data": 299800000.0, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "valid": true + }, + { + "description": "Valid - special value NAN", + "data": "NAN", + "valid": true + }, + { + "description": "Valid - special value INFINITY", + "data": "INFINITY", + "valid": true + }, + { + "description": "Valid - special value -INFINITY", + "data": "-INFINITY", + "valid": true + }, + { + "description": "Invalid - string with wrong case", + "data": "nan", + "valid": false + }, + { + "description": "Invalid - string with wrong case", + "data": "infinity", + "valid": false + }, + { + "description": "Invalid - JavaScript style", + "data": "Infinity", + "valid": false + }, + { + "description": "Invalid - wrong special value string", + "data": "inf", + "valid": false + }, + { + "description": "Invalid - numeric string", + "data": "1.5", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Valid - integer value", + "data": 42, + "valid": true + }, + { + "description": "Valid - negative integer value", + "data": -100, + "valid": true + }, + { + "description": "Valid - large value within range", + "data": 10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104.0, + "valid": true + }, + { + "description": "Valid - small negative value within range", + "data": -10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104.0, + "valid": true + } + ] +} diff --git a/test/iso/c/2024/float-special.test.json b/test/iso/c/2024/float-special.test.json new file mode 100644 index 0000000..02e75c1 --- /dev/null +++ b/test/iso/c/2024/float-special.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/float-special.json", + "tests": [ + { + "description": "Valid - NAN", + "data": "NAN", + "valid": true + }, + { + "description": "Valid - INFINITY", + "data": "INFINITY", + "valid": true + }, + { + "description": "Valid - -INFINITY", + "data": "-INFINITY", + "valid": true + }, + { + "description": "Invalid - lowercase nan", + "data": "nan", + "valid": false + }, + { + "description": "Invalid - lowercase infinity", + "data": "infinity", + "valid": false + }, + { + "description": "Invalid - JavaScript style Infinity", + "data": "Infinity", + "valid": false + }, + { + "description": "Invalid - wrong special value string", + "data": "inf", + "valid": false + }, + { + "description": "Invalid - abbreviation INF", + "data": "INF", + "valid": false + }, + { + "description": "Invalid - arbitrary string", + "data": "not-a-number", + "valid": false + }, + { + "description": "Invalid type - number zero", + "data": 0, + "valid": false + }, + { + "description": "Invalid type - floating point number", + "data": 1.5, + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + } + ] +} diff --git a/test/iso/c/2024/float.test.json b/test/iso/c/2024/float.test.json new file mode 100644 index 0000000..037d8c5 --- /dev/null +++ b/test/iso/c/2024/float.test.json @@ -0,0 +1,121 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/float.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1.5, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -3.14, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 340282346600000016151267322115014000640.0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -340282346600000016151267322115014000640.0, + "valid": true + }, + { + "description": "Valid - special value NAN", + "data": "NAN", + "valid": true + }, + { + "description": "Valid - special value INFINITY", + "data": "INFINITY", + "valid": true + }, + { + "description": "Valid - special value -INFINITY", + "data": "-INFINITY", + "valid": true + }, + { + "description": "Invalid - above maximum", + "data": 350000000000000001565567347835409530880.0, + "valid": false + }, + { + "description": "Invalid - below minimum", + "data": -350000000000000001565567347835409530880.0, + "valid": false + }, + { + "description": "Invalid - far above maximum", + "data": 10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104.0, + "valid": false + }, + { + "description": "Invalid - far below minimum", + "data": -10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104.0, + "valid": false + }, + { + "description": "Invalid - string with wrong case", + "data": "nan", + "valid": false + }, + { + "description": "Invalid - string with wrong case", + "data": "infinity", + "valid": false + }, + { + "description": "Invalid - JavaScript style", + "data": "Infinity", + "valid": false + }, + { + "description": "Invalid - wrong special value string", + "data": "inf", + "valid": false + }, + { + "description": "Invalid - numeric string", + "data": "1.5", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Valid - integer value", + "data": 42, + "valid": true + }, + { + "description": "Valid - negative integer value", + "data": -100, + "valid": true + } + ] +} diff --git a/test/iso/c/2024/int16_t.test.json b/test/iso/c/2024/int16_t.test.json new file mode 100644 index 0000000..e8670b5 --- /dev/null +++ b/test/iso/c/2024/int16_t.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/int16_t.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -32768, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 32767, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1000, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -1000, + "valid": true + }, + { + "description": "Invalid - below minimum", + "data": -32769, + "valid": false + }, + { + "description": "Invalid - above maximum", + "data": 32768, + "valid": false + }, + { + "description": "Invalid - large positive value", + "data": 100000, + "valid": false + }, + { + "description": "Invalid - large negative value", + "data": -100000, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "1000", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Invalid type - float", + "data": 100.5, + "valid": false + } + ] +} diff --git a/test/iso/c/2024/int32_t.test.json b/test/iso/c/2024/int32_t.test.json new file mode 100644 index 0000000..ff9d723 --- /dev/null +++ b/test/iso/c/2024/int32_t.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/int32_t.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -2147483648, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 2147483647, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 42, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -999, + "valid": true + }, + { + "description": "Invalid - below minimum", + "data": -2147483649, + "valid": false + }, + { + "description": "Invalid - above maximum", + "data": 2147483648, + "valid": false + }, + { + "description": "Invalid - large positive value", + "data": 10000000000, + "valid": false + }, + { + "description": "Invalid - large negative value", + "data": -10000000000, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "42", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Invalid type - float", + "data": 42.5, + "valid": false + } + ] +} diff --git a/test/iso/c/2024/int64_t.test.json b/test/iso/c/2024/int64_t.test.json new file mode 100644 index 0000000..cbcf17f --- /dev/null +++ b/test/iso/c/2024/int64_t.test.json @@ -0,0 +1,61 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/int64_t.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -9223372036854775808, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 9223372036854775807, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1000000000, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -1000000000, + "valid": true + }, + { + "description": "Invalid type - string", + "data": "1000000000", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Invalid type - float", + "data": 1000.5, + "valid": false + } + ] +} diff --git a/test/iso/c/2024/int8_t.test.json b/test/iso/c/2024/int8_t.test.json new file mode 100644 index 0000000..14d3d57 --- /dev/null +++ b/test/iso/c/2024/int8_t.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/int8_t.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -128, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 127, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 42, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -99, + "valid": true + }, + { + "description": "Invalid - below minimum", + "data": -129, + "valid": false + }, + { + "description": "Invalid - above maximum", + "data": 128, + "valid": false + }, + { + "description": "Invalid - large positive value", + "data": 1000, + "valid": false + }, + { + "description": "Invalid - large negative value", + "data": -1000, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "42", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Invalid type - float", + "data": 1.5, + "valid": false + } + ] +} diff --git a/test/iso/c/2024/uint16_t.test.json b/test/iso/c/2024/uint16_t.test.json new file mode 100644 index 0000000..c1a9c70 --- /dev/null +++ b/test/iso/c/2024/uint16_t.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/uint16_t.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": 0, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 65535, + "valid": true + }, + { + "description": "Valid - mid-range value", + "data": 32768, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1000, + "valid": true + }, + { + "description": "Invalid - negative value", + "data": -1, + "valid": false + }, + { + "description": "Invalid - above maximum", + "data": 65536, + "valid": false + }, + { + "description": "Invalid - large positive value", + "data": 100000, + "valid": false + }, + { + "description": "Invalid - large negative value", + "data": -1000, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "1000", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Invalid type - float", + "data": 100.5, + "valid": false + } + ] +} diff --git a/test/iso/c/2024/uint32_t.test.json b/test/iso/c/2024/uint32_t.test.json new file mode 100644 index 0000000..96d5248 --- /dev/null +++ b/test/iso/c/2024/uint32_t.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/uint32_t.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": 0, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 4294967295, + "valid": true + }, + { + "description": "Valid - mid-range value", + "data": 2147483648, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 42, + "valid": true + }, + { + "description": "Invalid - negative value", + "data": -1, + "valid": false + }, + { + "description": "Invalid - above maximum", + "data": 4294967296, + "valid": false + }, + { + "description": "Invalid - large positive value", + "data": 10000000000, + "valid": false + }, + { + "description": "Invalid - large negative value", + "data": -1000, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "42", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Invalid type - float", + "data": 42.5, + "valid": false + } + ] +} diff --git a/test/iso/c/2024/uint8_t.test.json b/test/iso/c/2024/uint8_t.test.json new file mode 100644 index 0000000..c9001f0 --- /dev/null +++ b/test/iso/c/2024/uint8_t.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/iso/c/2024/uint8_t.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": 0, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 255, + "valid": true + }, + { + "description": "Valid - mid-range value", + "data": 128, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 42, + "valid": true + }, + { + "description": "Invalid - negative value", + "data": -1, + "valid": false + }, + { + "description": "Invalid - above maximum", + "data": 256, + "valid": false + }, + { + "description": "Invalid - large positive value", + "data": 1000, + "valid": false + }, + { + "description": "Invalid - large negative value", + "data": -100, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "42", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + }, + { + "description": "Invalid type - float", + "data": 1.5, + "valid": false + } + ] +}