summaryrefslogtreecommitdiff
path: root/test/io/read_test.cpp
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-08-06 13:33:23 +0200
committerljfa-ag <ljfa-ag@web.de>2015-08-06 13:33:23 +0200
commite9dd438bd78b10c56e47479db7c7b3e2a3e9ab3a (patch)
treeb9ff7b412c6909d42428c83f85ddffe3d9b19574 /test/io/read_test.cpp
parentf39de6ad5bb4689ec13877508b55156d2d67ce79 (diff)
downloadProject-Tick-e9dd438bd78b10c56e47479db7c7b3e2a3e9ab3a.tar.gz
Project-Tick-e9dd438bd78b10c56e47479db7c7b3e2a3e9ab3a.zip
Add test for read failure (EOF in tag)
Diffstat (limited to 'test/io/read_test.cpp')
-rw-r--r--test/io/read_test.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/io/read_test.cpp b/test/io/read_test.cpp
index 0b29483f1e..d13402c2ea 100644
--- a/test/io/read_test.cpp
+++ b/test/io/read_test.cpp
@@ -143,9 +143,22 @@ void test_read_bigtest()
{0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f}));
}
+void test_read_errors()
+{
+ std::ifstream file;
+ nbt::io::stream_reader reader(file);
+
+ //EOF within a tag_double payload
+ file.open("errortest_eof1", std::ios::binary);
+ ASSERT(file);
+ EXPECT_EXCEPTION(reader.read_tag(), io::input_error);
+ ASSERT(!file);
+}
+
int main()
{
test_stream_reader_big();
test_stream_reader_little();
test_read_bigtest();
+ test_read_errors();
}