Published on 08/21/2024 03:18 by Stephen Horne
JSON and the Golden Fleece, Pt 3
I think I have a minimum implementation of the necessary Data Classes for storing the parsed JSON data. The project repository, so far:
$ tree
.
├── build
├── README.md
├── src
│ └── class
│ ├── json
│ │ ├── ArrayNode.hpp
│ │ ├── BooleanNode.hpp
│ │ ├── NullNode.hpp
│ │ ├── NumberNode.hpp
│ │ ├── ObjectNode.hpp
│ │ ├── StringNode.hpp
│ │ └── ValueNodeBase.hpp
│ └── test
│ └── TestRunner.hpp
└── test
├── build
│ └── run
├── Makefile
└── src
├── class
│ ├── ArrayNode.test.cpp
│ ├── ArrayNode.test.hpp
│ ├── BooleanNode.test.cpp
│ ├── BooleanNode.test.hpp
│ ├── NullNode.test.cpp
│ ├── NullNode.test.hpp
│ ├── NumberNode.test.cpp
│ ├── NumberNode.test.hpp
│ ├── ObjectNode.test.cpp
│ ├── ObjectNode.test.hpp
│ ├── StringNode.test.cpp
│ ├── StringNode.test.hpp
│ ├── ValueNodeBase.test.cpp
│ └── ValueNodeBase.test.hpp
└── run.cpp
10 directories, 26 files
I’ll need some more data types for the actual parsing, but these should offer a minimal data strcture. We’ll see.
I spent some time today setting up GitHub Actions to block merges to the main branch of this project’s repository unless all the tests pass. Standard stuff. It makes this project feel more or less legitimate and, more importantly, will put a greater and greater barrier between me and doing something stupid as more tests are added. You know, like I’ve learned to do over the last 7+ years doing this for a living.
In case you’re concerned about the apparently useless 'success' == 'success'
part of that output, have a look at this
- name: Report test results
if: always()
run: |
if [ '${{ steps.makefile.outcome }}' == 'success' ]; then
echo -e "\033[1;32mTests passed :-)\033[0m"
exit 0
else
echo -e "\033[1;31mTests failed :-(\033[0m"
exit 1
fi
I believe it will soon be time to begin implementing my parsing algorithm. I
look forward to sharing progress as it is made, things are learned, and theories
tested. Please follow the link at the top if you want to poke around my amateur
C++ code. I’ve got nothing to hide (except private
class members BADOOM CHSH).
And before you say it, I know TestRunner
is hacky. It is the result of an
iterative, MacGyver-esque process of tweaks I’ve made to aid me on this
harrowing-but-immensely-rewarding quest.
And with that, mes amis, I say to you: “bye bye.”
Written by Stephen Horne
← Back to blog