Ticket #3953: mapped_file_test.patch

File mapped_file_test.patch, 1.1 KB (added by egoots@…, 13 years ago)

Test added which triggers the described failure

  • libs/iostreams/test/mapped_file_test.cpp

     
    175175        );
    176176    }
    177177
     178    //--------------Writing to a pre-existing file---------------------------//
     179    {
     180        // Test for Bug #3953 - writing to a pre-existing mapped file.
     181        boost::iostreams::test::test_file  first, test;
     182
     183        mapped_file_params p(first.name());
     184        p.new_file_size = boost::iostreams::test::data_reps * boost::iostreams::test::data_length();
     185        boost::iostreams::stream<mapped_file_sink> out;
     186        out.open(mapped_file_sink(p));
     187        boost::iostreams::test::write_data_in_chars(out);
     188        out.close();
     189        BOOST_CHECK_MESSAGE(
     190            boost::iostreams::test::compare_files(first.name(), test.name()),
     191            "failed writing to pre-existing mapped file in chars"
     192        );
     193    }
     194   
    178195    //--------------Random access with a mapped_file--------------------------//
    179196
    180197    {