-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write test WDL++ files and JSON parsers to test out parsing of JSON files for WDL purposes #485
Comments
Created a branch for working on the issue: json_parse_test. This is where all work for testing the JSON parsing will go. |
The branch work is now within chiventure/src/wdl/sandbox. There is now a file parser.c used for testing, a Makefile for compiling parser.c, and a .json file used for tests. parser.c currently on utilizes a basic main function. Ideally the goal is to move into more individual functions for parsing rooms, items, and the game object respectively. The Makefile looks for the json-c library, which is required to be installed to use the tests. The current JSON file is just the original connected_rooms.wdl file converted to JSON format using a YAML converter . |
Added a print function that will print out the first test. The code is able to now access the "intro" part of the game object. Next step is to start moving the actual JSON object creation into their own files so the main function isn't super bulky. Then add more tests for the rooms and items. |
Parsing now occurs in its own function separate 'parse()' from the main function that can return the actual top level JSON object. This is a start, but it still isn't near enough for a full test of parsing. |
Started rewrite code to convert from JSON object to game_t object. Hypothetically, if the tests work, the libobj code wouldn't even be necessary for the purposes of converting from WDL to game object. I can't get the Makefile to work, though, which is preventing me from testing. |
Closing this issue in order to move on to the new sprint. The test files are all located in the branch json_parse_test. We were able to achieve parsing the JSON information from JSON string to a JSON object. From these the tests, we can conclude that JSON is most definitely easier to parse from than YAML. While I was unable to test the integration with other parts of the Chiventure code as I could not get the integration in the Makefile to function properly, the code for the integration, while imperfect, should hopefully serve as somewhat of a model for how we might be able to integrate future attempts at constructing. From writing the code, it does seem we might, if we choose, be able to skip libobj entirely and could convert from JSON objects straight to game objects. |
Issue Score: ✔️+ Comments: |
The issue with the Makefile was fixed and the code was completed in order to be able to print out proof that the parse functioned. It should now properly serve as a model for how we might be able to convert a JSON file into a game object. The code was pulled into dev in #599. As this branch is still being used by @dtbukowski in #529, the branch shall not be deleted. |
In order to understand how to integrate the WDL++ system using JSON, we will be writing test parsers and test files.
These test files should be written in the tests.
The text was updated successfully, but these errors were encountered: