https://github.com/nst/JSONTestSuite
A comprehensive test suite for RFC 8259 compliant JSON parsers
https://github.com/nst/JSONTestSuite
Last synced: 12 months ago
JSON representation
A comprehensive test suite for RFC 8259 compliant JSON parsers
- Host: GitHub
- URL: https://github.com/nst/JSONTestSuite
- Owner: nst
- License: mit
- Created: 2016-10-23T19:14:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-11-02T13:41:16.000Z (over 2 years ago)
- Last Synced: 2024-01-25T07:33:58.808Z (about 2 years ago)
- Language: C++
- Homepage:
- Size: 82.9 MB
- Stars: 818
- Watchers: 33
- Forks: 138
- Open Issues: 42
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-json - JSON Parsing Test Suite - A very complete test suite and validation framework. (Testing)
README
# JSON Parsing Test Suite
A comprehensive test suite for RFC 8259 compliant JSON parsers
This repository was created as an appendix to the article [Parsing JSON is a Minefield 💣](http://seriot.ch/parsing_json.php).
**/parsers/**
This directory contains several parsers and tiny wrappers to turn the parsers into JSON validators, by returning a specific value.
- `0` the parser did accept the content
- `1` the parser did reject the content
- `>1` the process did crash
- `timeout` happens after 5 seconds
**/test\_parsing/**
The name of these files tell if their contents should be accepted or rejected.
- `y_` content must be accepted by parsers
- `n_` content must be rejected by parsers
- `i_` parsers are free to accept or reject content
**/test\_transform/**
These files contain weird structures and characters that parsers may understand differently, eg:
- huge numbers
- dictionaries with similar keys
- NULL characters
- escaped invalid strings
These files were used to produce `results/transform.html`.
**/run_tests.py**
Run all parsers with all files:
$ python3 run_tests.py
Run all parsers with a specific file:
$ python3 run_tests.py file.json
Run specific parsers with all files:
$ echo '["Python 2.7.10", "Python 3.5.2"]' > python_only.json
$ python3 run_tests.py --filter=python_only.json
The script writes logs in `results/logs.txt`.
The script then reads `logs.txt` and generates `results/parsing.html`.
**/results/**