From b6075360deb86d444c0df453389414eaee39f9fe Mon Sep 17 00:00:00 2001 From: vng Date: Fri, 24 Feb 2012 21:57:21 +0300 Subject: [PATCH] Test for FileWriter (not enough disk space). --- coding/coding_tests/mem_file_writer_test.cpp | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/coding/coding_tests/mem_file_writer_test.cpp b/coding/coding_tests/mem_file_writer_test.cpp index 64b1d68f45..c1ec148be5 100644 --- a/coding/coding_tests/mem_file_writer_test.cpp +++ b/coding/coding_tests/mem_file_writer_test.cpp @@ -2,8 +2,11 @@ #include "../../testing/testing.hpp" #include "../writer.hpp" +#include "../file_writer.hpp" + #include "../../base/macros.hpp" + UNIT_TEST(MemWriterEmpty) { vector data; @@ -20,7 +23,20 @@ UNIT_TEST(MemWriterSimple) writer.Write("Hello", 5); writer.Write(",", 1); writer.Write("world!", 6); - char const expected_string[] = "Hello,world!"; - vector expected_data(&expected_string[0], &expected_string[ARRAY_SIZE(expected_string)-1]); - TEST_EQUAL(data, expected_data, ()); + + char const expected[] = "Hello,world!"; + TEST_EQUAL(data.size(), ARRAY_SIZE(expected)-1, ()); + TEST(equal(data.begin(), data.end(), &expected[0]), (data)); } + +/* +UNIT_TEST(FileWriter_NoDiskSpace) +{ + FileWriter w("/Volumes/Untitled/file.bin"); + + vector bytes(100000000); + + for (size_t i = 0; i < 10; ++i) + w.Write(&bytes[0], bytes.size()); +} +*/