NBT: implement the overloaded writeInt8Array
parent
ecd1bfa496
commit
847b73c6ae
|
@ -319,7 +319,10 @@ namespace NBT {
|
|||
}
|
||||
|
||||
void writeInt8Array(std::vector<uint8_t>* destination, std::vector<int8_t> data) {
|
||||
|
||||
writeInt32(destination, data.size());
|
||||
for(int8_t datum: data){
|
||||
destination->push_back(datum);
|
||||
}
|
||||
}
|
||||
|
||||
void writeInt8Array(std::vector<uint8_t>* destination, int8_t data[], uint32_t dataSize) {
|
||||
|
|
|
@ -219,6 +219,18 @@ int main(){
|
|||
int8ArrayTestOutput->at(6) == 3 &&
|
||||
int8ArrayTestOutput->at(7) == 4
|
||||
);
|
||||
int8ArrayTestOutput->clear();
|
||||
NBT::helper::writeInt8Array(int8ArrayTestOutput, std::vector<int8_t>({1,2,3,4}));
|
||||
ASSERT(
|
||||
int8ArrayTestOutput->at(0) == 0 &&
|
||||
int8ArrayTestOutput->at(1) == 0 &&
|
||||
int8ArrayTestOutput->at(2) == 0 &&
|
||||
int8ArrayTestOutput->at(3) == 4 &&
|
||||
int8ArrayTestOutput->at(4) == 1 &&
|
||||
int8ArrayTestOutput->at(5) == 2 &&
|
||||
int8ArrayTestOutput->at(6) == 3 &&
|
||||
int8ArrayTestOutput->at(7) == 4
|
||||
);
|
||||
delete int8ArrayTestOutput;
|
||||
std::cout << "Passed writeInt8Array NBT helper test" << std::endl;
|
||||
|
||||
|
|
Loading…
Reference in New Issue