| 1 | // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) |
| 2 | // (C) Copyright 2004-2007 Jonathan Turkanis |
| 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) |
| 5 | |
| 6 | // See http://www.boost.org/libs/iostreams for documentation. |
| 7 | |
| 8 | // Contains the definitions of several constants used by the test program. |
| 9 | |
| 10 | #ifndef BOOST_IOSTREAMS_TEST_CONSTANTS_HPP_INCLUDED |
| 11 | #define BOOST_IOSTREAMS_TEST_CONSTANTS_HPP_INCLUDED |
| 12 | |
| 13 | #include <string.h> |
| 14 | #include <boost/config.hpp> |
| 15 | |
| 16 | namespace boost { namespace iostreams { namespace test { |
| 17 | |
| 18 | // Note: openmode could be a class type, so this header must be included |
| 19 | // by just one TU. |
| 20 | const BOOST_IOS::openmode in_mode = BOOST_IOS::in | BOOST_IOS::binary; |
| 21 | const BOOST_IOS::openmode out_mode = BOOST_IOS::out | BOOST_IOS::binary; |
| 22 | |
| 23 | // Chunk size for reading or writing in chunks. |
| 24 | const int chunk_size = 59; |
| 25 | |
| 26 | // Chunk size for reading or writing in chunks. |
| 27 | const int small_buffer_size = 23; |
| 28 | |
| 29 | // Number of times data is repeated in test files. |
| 30 | const int data_reps = 300; |
| 31 | |
| 32 | namespace detail { |
| 33 | |
| 34 | // Returns string which is used to generate test files. |
| 35 | inline const char* data(char*) |
| 36 | { |
| 37 | static const char* c = |
| 38 | "!\"#$%&'()*+,-./0123456879:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 39 | "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n" ; |
| 40 | return c; |
| 41 | } |
| 42 | |
| 43 | // Returns string which is used to generate test files. |
| 44 | inline const wchar_t* data(wchar_t*) |
| 45 | { |
| 46 | static const wchar_t* c = |
| 47 | L"!\"#$%&'()*+,-./0123456879:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 48 | L"[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n" ; |
| 49 | return c; |
| 50 | } |
| 51 | |
| 52 | } // End namespace detail. |
| 53 | |
| 54 | inline const char* narrow_data() { return detail::data((char*)0); } |
| 55 | |
| 56 | inline const wchar_t* wide_data() { return detail::data((wchar_t*)0); } |
| 57 | |
| 58 | // Length of string returned by data(). |
| 59 | inline int data_length() |
| 60 | { |
| 61 | static int len = (int) strlen(s: narrow_data()); |
| 62 | return len; |
| 63 | } |
| 64 | |
| 65 | } } } // End namespaces detail, iostreams, boost. |
| 66 | |
| 67 | #endif // #ifndef BOOST_IOSTREAMS_TEST_CONSTANTS_HPP_INCLUDED |
| 68 | |