1 /* SuperRead pipeline
2 * Copyright (C) 2012 Genome group at University of Maryland.
3 *
4 * This program is free software: you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation, either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18
19 #include <sstream>
20 #include <gtest/gtest.h>
21 #include <charbuf.hpp>
22
TEST(Charstream,Output)23 TEST(Charstream, Output) {
24 charstream s(10);
25 const char *l1 = "Hello\n";
26 const char *l2 = "Longer text\n";
27 const char *l3 = "Sho\n";
28
29 s << l1;
30 EXPECT_EQ(strlen(l1), s.size());
31 std::ostringstream os1;
32 os1 << s;
33 EXPECT_STREQ(l1, os1.str().c_str());
34 s.rewind();
35 EXPECT_EQ((size_t)0, s.size());
36
37 s << l2;
38 EXPECT_EQ(strlen(l2), s.size());
39 std::ostringstream os2;
40 os2 << s;
41 EXPECT_STREQ(l2, os2.str().c_str());
42 s.rewind();
43 EXPECT_EQ((size_t)0, s.size());
44
45 s << l3;
46 EXPECT_EQ(strlen(l3), s.size());
47 std::ostringstream os3;
48 os3 << s;
49 EXPECT_STREQ(l3, os3.str().c_str());
50 s.rewind();
51 EXPECT_EQ((size_t)0, s.size());
52 }
53