BodgeMaster
9190cad80d
lib/nbt: finish implementation of validateRawNBTData() and fix a critical macro-induced bug
...
I did a `#define return` and then tried to `if () return;` everywhere...
2022-08-15 08:50:07 +02:00
BodgeMaster
a862590370
lib/nbt: Start implementing the NBT validator
...
In theory, this is it. It’s just missing the portion that deals with lists
and unit tests. Both will each likely require similar effort to this.
2022-08-15 05:20:05 +02:00
BodgeMaster
3995e97f03
lib/javacompat: Make the endianness error message refer to the correct function
2022-08-15 02:07:00 +02:00
BodgeMaster
c9ec524db1
test/nbt_size_helpers: Implement tests for valid input
2022-08-13 17:32:47 +02:00
BodgeMaster
73ae58e522
test/assert: Add line number to assertion failed message
2022-08-13 17:32:47 +02:00
BodgeMaster
acc19ae100
lib/nbt: Change behavior of totalTagSize to treat encounters of compounds and lists as errors
...
I stumbled over this when writing the unit test. Previously, it would return
an error code but explicitly mark it as not being an error. This was intended
behavior but I decided to change it because I didn’t anticipate it when writing
the test.
Technically `ErrorOr<T>` can be used to pass any message alongside `T`,
but practically, it is reasonable to assume that the error code is
`ErrorCodes::SUCCESS` when `isError` is false. Therefore, this feature
should be really only used in the weirdest edge cases - if at all.
Even then, it is most likely still preferable to flag it as an error and
just hand the resulting `T` back using the long constructor
`ErrorOr<T>(bool, uint8_t, T)`.
2022-08-13 17:32:47 +02:00
BodgeMaster
149285c357
lib/nbt: Finish implementing containedDataLength, rename nextTagTotalSize->totalTagSize and nextTagDataLength->containedDataLength
2022-08-13 17:32:47 +02:00
BodgeMaster
0c92bdf8fd
test/nbt_size_helpers: begin adding unit tests for lib/nbt's new nextTag size helpers
2022-08-13 17:32:47 +02:00
BodgeMaster
86f1ef596f
lib/nbt: Begin implementing nextTagDataLength
2022-08-13 17:32:47 +02:00
BodgeMaster
027f324f03
lib/nbt: Fix a bug in nextTagTotalSize and significantly improve readability by removing redundant code
2022-08-13 17:32:47 +02:00
BodgeMaster
7a2c1d7d57
scripts/test: Clean old unit tests before building new ones to avoid confusion
...
if a unit test fails to build and old unit tests remain in place, this can
lead to confusion when the old test is run anyway.
"Why are some test cases missing?"
"Huh, it failed to build but passed?"
2022-08-13 17:32:47 +02:00
BodgeMaster
6fecb2cdb7
scripts/test/hexnet: Add license information
...
Yeah, I forgot it again -_-
2022-08-13 17:32:47 +02:00
BodgeMaster
e882a09099
Build system: Improve output readability and prepare for script based unit tests
2022-08-13 17:32:47 +02:00
BodgeMaster
748c91c375
scripts/test: change unit test file names
2022-08-13 17:32:47 +02:00
BodgeMaster
f5d85da98c
lib/nbt: Move the functions for getting tag sizes into the helper namespace, give up on handling lists the same as all other tags
...
I tried dealing with lists in the same way as with other more basic tags
but came to the conclusion that this is most likely not feasible in the same
way that it is not feasible for compounds. It would require a mini-parser
that can deal with all sorts of tags (including nested lists and compounds).
Instead, an approach more similar to the recursion for compound tags will
be used (using its own function to deal with the missing tag headers ofc).
2022-08-13 17:32:47 +02:00
BodgeMaster
396b9673fd
lib/nbt: Various minor fixes to get the program to compile properly
2022-08-13 17:32:47 +02:00
BodgeMaster
68fbf3ae20
lib/nbt: remove a function used to get the next tag type which introduced unnecessary complexity
2022-08-13 17:32:47 +02:00
BodgeMaster
4363432025
Environment: don't unset PROJECT_BASE_DIR which is needed for the aliases to work properly
2022-08-13 17:32:47 +02:00
BodgeMaster
5400790e78
test/nbt*: rename files, move byte tag object test from helper test file into its own file
2022-08-13 17:32:47 +02:00
BodgeMaster
c7dd5471dd
lib/nbt: Start implementing NBT validator
2022-08-13 17:32:47 +02:00
BodgeMaster
8048dc8891
tools/hexnet: Put the new usage generator to use and remove prefixes for IPv4 and IPv6
...
The prefixes were part of a planned feature but since a connection is
either IPv4 or IPv6 but never both, it would have been completely useless
to specify which to use. Instead, only TCP and UDP will need to be specified.
2022-08-12 12:30:55 +02:00
BodgeMaster
a1f16e6f6b
lib/cli: Fix the usage text generator not dealing well with absent sections
2022-08-12 11:59:42 +02:00
Shwoomple
cb7b5ddba7
lib/cli: Add usage generator.
2022-08-12 13:35:56 +05:30
Shwoomple
e0648720bb
tools/hexnet: Implement ipv6 support.
2022-08-11 22:55:12 +05:30
Shwoomple
ebcf436a18
lib/cli: delete duplicate header file.
2022-08-11 18:57:22 +05:30
BodgeMaster
c59a1ac723
Resources: Add two NBT files that can be used for testing.
2022-08-05 09:12:27 +02:00
BodgeMaster
aef91fe7cd
test/nbt_helpers: Fix wrong test pass message
2022-08-04 07:50:20 +02:00
BodgeMaster
4af9003761
Code style: I just decided to accept that float and double exist and that we can just assume they are 32 and 64 bits repectively.
...
This isn't going to run on an Arduino or anything like that anyway.
2022-08-04 07:47:24 +02:00
Milan Suman
704b440d5a
lib/nbt: Add tag classes
2022-08-04 00:01:12 +05:30
BodgeMaster
608767f5c2
tools/hexnet: Add more command line flags and options
...
This only adds the options to the parser. They aren't used anywhere in the code yet.
2022-08-02 03:42:37 +02:00
BodgeMaster
e31bff0802
test/nbt_writestring_failure_mode: Add license information
2022-08-02 03:37:10 +02:00
BodgeMaster
5c73308934
Rename all headers from .h++ to .hpp
...
Idk why I did that in the first place. Probably bc hpp looks stupid.
But having a + in a file name bugs me just as much. And other ppl as well.
So I changed it.
2022-08-02 03:35:08 +02:00
BodgeMaster
b59fe1857e
lib/cli: minor refactoring to make things less confusing and nicer to use
...
I renamed "unpositional arguments" to "options" and "positional arguments" to "arguments".
This is intended to make the code more readable and easier to type out.
2022-08-02 03:16:54 +02:00
BodgeMaster
69f15e928a
lib/cli: Add fields for a short description and additional usage information to the arguments parser
...
This is in preparation for building the help text generator.
2022-08-02 02:03:50 +02:00
BodgeMaster
d0d02fc8d2
tools/hexnet: Move the TCP reading portion to a thread
...
This was too straight-forward to not just do it when I previously worked
on hexnet. Why didn't I just do it? Idk.
2022-08-02 01:07:20 +02:00
BodgeMaster
1308327fae
tests: OCD fixes lol
...
sorry
2022-08-02 01:04:45 +02:00
BodgeMaster
4582c3e595
test/nbt_helpers: move the test that aborts to its own program
2022-08-02 00:41:11 +02:00
BodgeMaster
28719072bb
fix a compiler warning
2022-08-01 16:39:18 +02:00
BodgeMaster
800fd66044
Build system: fix typo
2022-07-30 21:14:23 +02:00
BodgeMaster
d90e7f16bd
Build system: better cross-platform compatibility
...
I hope we don't run into more versions of sha256(sum)...
2022-07-30 21:10:07 +02:00
BodgeMaster
845b3fb922
Documentation: update build system documentation and prerequisites in preparation for next commit
2022-07-30 21:08:03 +02:00
Milan Suman
4f1ad714bd
lib/nbt.cpp: Implement writeString function
2022-07-28 17:15:04 +05:30
BodgeMaster
adc9a7f36b
tools/hexnet: prepare for multithreading
...
Multithreading will be needed to simultaneously receive and send data.
The preparations include:
- move all the settings of the program into global scope
- add mutexes
- move the code that reads from the TCP socket into a dedicated function
2022-07-25 15:55:40 +02:00
BodgeMaster
b044503951
test/cli_argument_parser: get rid of useless parameters
...
(pointed out by compiler warning)
2022-07-23 10:55:03 +02:00
BodgeMaster
d97e1a8336
Build system: Use -Wextra
2022-07-23 10:54:05 +02:00
BodgeMaster
6baff11ebd
test/cli_argument_parser: implement tests for generated error messages
2022-07-21 09:41:04 +02:00
BodgeMaster
c9d6cf0b5e
lib/cli: minor consistency changes
2022-07-21 09:39:45 +02:00
BodgeMaster
7d7ce2ba6b
Documentation: Update build system documentation
2022-07-20 19:45:40 +02:00
BodgeMaster
a51c65c9f2
test/javacompat: get rid of a compiler warning
2022-07-20 19:22:06 +02:00
BodgeMaster
8bb0732cc6
Build system: add single-threaded compile mode to test script
2022-07-20 19:20:27 +02:00