null+****@clear*****
null+****@clear*****
2011年 11月 11日 (金) 14:24:48 JST
Susumu Yata 2011-11-11 05:24:48 +0000 (Fri, 11 Nov 2011) New Revision: 9d1b803e71b5a9d8a7e21bde63a11860e1ed3a9a Log: add test-string.hpp to define an operator to output grn::dat::String through std::ostream. Added files: test/unit/core/dat/test-string.hpp Modified files: test/unit/core/dat/Makefile.am test/unit/core/dat/test-key.cpp test/unit/core/dat/test-string.cpp Modified: test/unit/core/dat/Makefile.am (+3 -0) =================================================================== --- test/unit/core/dat/Makefile.am 2011-11-11 02:16:06 +0000 (aad3902) +++ test/unit/core/dat/Makefile.am 2011-11-11 05:24:48 +0000 (e2754de) @@ -39,6 +39,9 @@ LIBS = \ $(top_builddir)/test/unit/lib/libgrn-test-utils.la \ $(top_builddir)/test/unit/lib/libgrn-test-hash-utils.la +noinst_HEADERS = \ + test-string.hpp + test_array_la_SOURCES = test-array.cpp test_base_la_SOURCES = test-base.cpp test_block_la_SOURCES = test-block.cpp Modified: test/unit/core/dat/test-key.cpp (+1 -7) =================================================================== --- test/unit/core/dat/test-key.cpp 2011-11-11 02:16:06 +0000 (ac2e399) +++ test/unit/core/dat/test-key.cpp 2011-11-11 05:24:48 +0000 (7dc24ad) @@ -25,13 +25,7 @@ #include <cstring> #include <iostream> -namespace cut -{ - std::ostream &operator<<(std::ostream &stream, const grn::dat::String &str) - { - return stream.write(static_cast<const char *>(str.ptr()), str.length()); - } -} +#include "test-string.hpp" namespace test_dat_key { Modified: test/unit/core/dat/test-string.cpp (+1 -7) =================================================================== --- test/unit/core/dat/test-string.cpp 2011-11-11 02:16:06 +0000 (b0a5c83) +++ test/unit/core/dat/test-string.cpp 2011-11-11 05:24:48 +0000 (38788be) @@ -22,13 +22,7 @@ #include <grn-assertions.h> #include <dat/string.hpp> -namespace cut -{ - std::ostream &operator<<(std::ostream &stream, const grn::dat::String &str) - { - return stream.write(static_cast<const char *>(str.ptr()), str.length()); - } -} +#include "test-string.hpp" namespace test_dat_string { Added: test/unit/core/dat/test-string.hpp (+35 -0) 100644 =================================================================== --- /dev/null +++ test/unit/core/dat/test-string.hpp 2011-11-11 05:24:48 +0000 (ded7a01) @@ -0,0 +1,35 @@ +/* -*- c-basic-offset: 2; coding: utf-8 -*- */ +/* + Copyright (C) 2011 Brazil + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef GRN_DAT_TEST_STRING_HPP_ +#define GRN_DAT_TEST_STRING_HPP_ + +#include <dat/string.hpp> + +#include <iostream> + +namespace cut { + +inline std::ostream &operator<<(std::ostream &stream, + const grn::dat::String &str) { + return stream.write(static_cast<const char *>(str.ptr()), str.length()); +} + +} // namespace cut + +#endif // GRN_DAT_TEST_STRING_HPP_