diff options
| author | ljfa <ljfa-ag@web.de> | 2015-08-13 11:31:57 +0200 |
|---|---|---|
| committer | ljfa <ljfa-ag@web.de> | 2015-08-13 11:31:57 +0200 |
| commit | aac94b91ad83ad8f7832976e6da55d15de6e54e1 (patch) | |
| tree | 9caa79222933a300354c1cd2224915da471e94f5 /test | |
| parent | baf4a77df0ac95386b80bd915c2926c86e2c5a46 (diff) | |
| download | Project-Tick-aac94b91ad83ad8f7832976e6da55d15de6e54e1.tar.gz Project-Tick-aac94b91ad83ad8f7832976e6da55d15de6e54e1.zip | |
Add io::read_tag and write_tag functions
Diffstat (limited to 'test')
| -rw-r--r-- | test/read_test.cpp | 6 | ||||
| -rw-r--r-- | test/write_test.cpp | 10 |
2 files changed, 7 insertions, 9 deletions
diff --git a/test/read_test.cpp b/test/read_test.cpp index b9d8c59f6c..90ee392451 100644 --- a/test/read_test.cpp +++ b/test/read_test.cpp @@ -141,9 +141,8 @@ void test_read_bigtest() //Uses an extended variant of Notch's original bigtest file std::ifstream file("bigtest_uncompr", std::ios::binary); ASSERT(file); - nbt::io::stream_reader reader(file); - auto pair = reader.read_compound(); + auto pair = nbt::io::read_compound(file); ASSERT(pair.first == "Level"); verify_bigtest_structure(*pair.second); std::clog << "test_read_bigtest passed" << std::endl; @@ -154,9 +153,8 @@ void test_read_littletest() //Same as bigtest, but little endian std::ifstream file("littletest_uncompr", std::ios::binary); ASSERT(file); - nbt::io::stream_reader reader(file, endian::little); - auto pair = reader.read_compound(); + auto pair = nbt::io::read_compound(file, endian::little); ASSERT(pair.first == "Level"); ASSERT(pair.second->get_type() == tag_type::Compound); verify_bigtest_structure(*pair.second); diff --git a/test/write_test.cpp b/test/write_test.cpp index 78d6d8eaa6..d6eac53a53 100644 --- a/test/write_test.cpp +++ b/test/write_test.cpp @@ -206,25 +206,25 @@ void test_write_bigtest() written tag. Smaller-grained tests are already done above. */ std::ifstream file("bigtest_uncompr", std::ios::binary); - const auto orig_pair = io::stream_reader(file).read_compound(); + const auto orig_pair = io::read_compound(file); std::stringstream sstr; //Write into stream in Big Endian - io::stream_writer(sstr).write_tag(orig_pair.first, *orig_pair.second); + io::write_tag(orig_pair.first, *orig_pair.second, sstr); ASSERT(sstr); //Read from stream in Big Endian and compare - auto written_pair = io::stream_reader(sstr).read_compound(); + auto written_pair = io::read_compound(sstr); ASSERT(orig_pair.first == written_pair.first); ASSERT(*orig_pair.second == *written_pair.second); sstr.str(""); //Reset and reuse stream //Write into stream in Little Endian - io::stream_writer(sstr, endian::little).write_tag(orig_pair.first, *orig_pair.second); + io::write_tag(orig_pair.first, *orig_pair.second, sstr, endian::little); ASSERT(sstr); //Read from stream in Little Endian and compare - written_pair = io::stream_reader(sstr, endian::little).read_compound(); + written_pair = io::read_compound(sstr, endian::little); ASSERT(orig_pair.first == written_pair.first); ASSERT(*orig_pair.second == *written_pair.second); |
