Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
FileTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
4#include "storm/io/file.h"
5
6TEST(FileTest, GetLine) {
7 std::stringstream stream;
8 stream << "Hello world" << std::endl << "This is a test with n\nThis is a test with rn\r\n\nMore tests";
9
10 std::string str;
11 int i = 0;
12 std::string expected[] = {"Hello world", "This is a test with n", "This is a test with rn", "", "More tests"};
13 while (storm::io::getline(stream, str)) {
14 EXPECT_EQ(str, expected[i]);
15 ++i;
16 }
17}
18
19TEST(FileTest, GetLineEmpty) {
20 std::stringstream stream;
21 std::string str;
22 EXPECT_FALSE(storm::io::getline(stream, str));
23}
TEST(FileTest, GetLine)
Definition FileTest.cpp:6
std::basic_istream< CharT, Traits > & getline(std::basic_istream< CharT, Traits > &input, std::basic_string< CharT, Traits, Allocator > &str)
Overloaded getline function which handles different types of newline ( and \r).
Definition file.h:80