Compare commits
2 Commits
800fd66044
...
4582c3e595
Author | SHA1 | Date |
---|---|---|
BodgeMaster | 4582c3e595 | |
BodgeMaster | 28719072bb |
|
@ -34,6 +34,7 @@ COMPILE_COMMANDS=(
|
||||||
"$CXX_WITH_FLAGS src/test/nbt_helpers.cpp -I./include -Lbin/lib -l:nbt.so -l:javacompat.so -o bin/test/nbt_helpers"
|
"$CXX_WITH_FLAGS src/test/nbt_helpers.cpp -I./include -Lbin/lib -l:nbt.so -l:javacompat.so -o bin/test/nbt_helpers"
|
||||||
"$CXX_WITH_FLAGS src/test/cli_argument_parser.cpp -Lbin/lib -l:cli.so -o bin/test/cli_argument_parser"
|
"$CXX_WITH_FLAGS src/test/cli_argument_parser.cpp -Lbin/lib -l:cli.so -o bin/test/cli_argument_parser"
|
||||||
"$CXX_WITH_FLAGS src/test/javacompat.cpp -I./include -Lbin/lib -l:javacompat.so -o bin/test/javacompat"
|
"$CXX_WITH_FLAGS src/test/javacompat.cpp -I./include -Lbin/lib -l:javacompat.so -o bin/test/javacompat"
|
||||||
|
"$CXX_WITH_FLAGS src/test/nbt_writestring_failure_mode.cpp -I./include -Lbin/lib -l:nbt.so -l:javacompat.so -o bin/test/nbt_writestring_failure_mode"
|
||||||
)
|
)
|
||||||
for command in ${!COMPILE_COMMANDS[@]}; do
|
for command in ${!COMPILE_COMMANDS[@]}; do
|
||||||
echo "${COMPILE_COMMANDS[command]}"
|
echo "${COMPILE_COMMANDS[command]}"
|
||||||
|
@ -45,6 +46,7 @@ wait
|
||||||
|
|
||||||
echo "Running tests..."
|
echo "Running tests..."
|
||||||
|
|
||||||
|
set +e
|
||||||
for test in $(ls bin/test); do
|
for test in $(ls bin/test); do
|
||||||
bin/test/$test
|
bin/test/$test
|
||||||
done
|
done
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace JavaCompat {
|
||||||
//placeholder size bytes
|
//placeholder size bytes
|
||||||
output.push_back(0x00);
|
output.push_back(0x00);
|
||||||
output.push_back(0x00);
|
output.push_back(0x00);
|
||||||
for(int i=0; i<stdString.size(); i++){
|
for(uint16_t i=0; i<stdString.size(); i++){
|
||||||
if((uint8_t) stdString[i] == 0x00){
|
if((uint8_t) stdString[i] == 0x00){
|
||||||
*size += 1;
|
*size += 1;
|
||||||
output.push_back(0xc0);
|
output.push_back(0xc0);
|
||||||
|
@ -87,7 +87,6 @@ namespace JavaCompat {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
return ErrorOr(output);
|
return ErrorOr(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -522,8 +522,6 @@ int main(){
|
||||||
NBT::helper::writeString(exportedString, normalString);
|
NBT::helper::writeString(exportedString, normalString);
|
||||||
ASSERT(javaStdString1 == *exportedString);
|
ASSERT(javaStdString1 == *exportedString);
|
||||||
|
|
||||||
std::string overrunString = std::string(0xFFFFF, '.');
|
|
||||||
NBT::helper::writeString(exportedString, tiny_utf8::string(overrunString));
|
|
||||||
std::cout << "Passed writeString NBT helper test." << std::endl;
|
std::cout << "Passed writeString NBT helper test." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include "../lib/nbt.h++"
|
||||||
|
#include "../lib/error.h++"
|
||||||
|
#include "../lib/javacompat.h++"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::cout << "=================================" << std::endl;
|
||||||
|
std::cout << "NBT write string helper failure mode test" << std::endl;
|
||||||
|
std::cout << "=================================" << std::endl;
|
||||||
|
std::cout << "This is supposed to abort." << std::endl;
|
||||||
|
std::vector<uint8_t>* exportedString = new std::vector<uint8_t>();
|
||||||
|
std::string overrunString = std::string(0xFFFFF, '.');
|
||||||
|
NBT::helper::writeString(exportedString, tiny_utf8::string(overrunString));
|
||||||
|
}
|
Loading…
Reference in New Issue