diff options
| author | YongDo-Hyun <froster12@naver.com> | 2025-11-26 20:10:42 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-03-27 19:57:09 +0300 |
| commit | edbbe8dcfd30fcfe84f6b62240e22dbf9138677c (patch) | |
| tree | 8b9c8edb939d573d76d6390535d3eacf4342e9c4 /test/test_value.cpp | |
| parent | 687e43031df0dc641984b4256bcca50d5b3f7de3 (diff) | |
| download | Project-Tick-edbbe8dcfd30fcfe84f6b62240e22dbf9138677c.tar.gz Project-Tick-edbbe8dcfd30fcfe84f6b62240e22dbf9138677c.zip | |
feat: add local test executable and improve JSON string escaping - Added option to build a local test executable for value assignments. - Enhanced JSON string formatting by escaping special characters. - Updated README with build instructions and prerequisites. - Modified .gitignore to include .vscode directory. - Added file read/write tests in format_test.cpp. - Refactored value assignment logic to reduce code duplication.
Signed-off-by: YongDo-Hyun <froster12@naver.com>
Diffstat (limited to 'test/test_value.cpp')
| -rw-r--r-- | test/test_value.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/test_value.cpp b/test/test_value.cpp new file mode 100644 index 0000000000..009cefe8ef --- /dev/null +++ b/test/test_value.cpp @@ -0,0 +1,34 @@ +#include <iostream> +#include "nbt_tags.h" +#include "value.h" + +using namespace nbt; + +int main() +{ + try { + value v; + + v = int8_t(-5); + std::cout << "assigned int8_t(-5): as int32=" << int32_t(v) << ", as double=" << double(v) << "\n"; + + v = int16_t(12345); + std::cout << "assigned int16_t(12345): as int32=" << int32_t(v) << ", as double=" << double(v) << "\n"; + + v = int32_t(100000); + std::cout << "assigned int32_t(100000): as int64=" << int64_t(v) << ", as double=" << double(v) << "\n"; + + v = float(3.14f); + std::cout << "assigned float(3.14): as double=" << double(v) << "\n"; + + v = double(2.718281828); + std::cout << "assigned double(2.71828): as double=" << double(v) << "\n"; + + std::cout << "Test finished OK\n"; + } + catch(const std::exception& e) { + std::cerr << "Exception: " << e.what() << "\n"; + return 1; + } + return 0; +} |
