1
0
Fork
You've already forked cpp-bencode-parser
0
No description
  • C++ 96.8%
  • Makefile 3.2%
Find a file
2025年11月15日 22:21:57 +00:00
bin Add basic parser executable accepting stdin input 2025年11月15日 22:18:06 +00:00
src Omit node type in dict node format string 2025年11月15日 21:53:13 +00:00
tests Omit node type in dict node format string 2025年11月15日 21:53:13 +00:00
.clang-format Initial commit 2025年10月21日 23:07:54 +01:00
.clangd Update to clang++ version 19 2025年10月29日 20:46:48 +00:00
.gitignore Initial commit 2025年10月21日 23:07:54 +01:00
compile_flags.txt Initial commit 2025年10月21日 23:07:54 +01:00
Makefile Add basic parser executable accepting stdin input 2025年11月15日 22:18:06 +00:00
README.md Add README document 2025年11月15日 22:21:57 +00:00

Running the parser executable

The parser executable currently only supports receiving data from stdin.

The following shows an example of building it, and running it with a few simple inputs:

> make
...
> echo "i3e" | ./main.out
3
> echo "5:hello" | ./main.out
"hello"
> echo "li2ei5ee" | ./main.out
[2, 5]
> echo "d5:helloi2e7:goodbyei67ee" | ./main.out
{"goodbye": 67, "hello": 2}
> echo "d3:fooli2e9:somethinge3:bard5:helloi2e7:goodbyei-1ee" | ./main.out
{"bar": {"goodbye": -1, "hello": 2}, "foo": [2, "something"]}

Running the tests

Catch2 is used for defining unit tests.

To run the tests:

  • clone this repo
  • download this Catch2 header file from the Catch2 repo and place it in a directory called external/ in the root of the cloned repo
  • run the make tests command, which should build and run the test suite