15 namespace test_utils {
18 auto const length = text.size();
20 auto const num_whitespaces = length - text.size();
21 assert(num_whitespaces <= std::numeric_limits<int>::max());
22 return static_cast<int>(num_whitespaces);
54 std::string indented_text;
55 int num_whitespaces = 0;
58 std::stringstream stream(text);
59 std::string indent(4 * indent_level,
' ');
61 while (std::getline(stream, line)) {
70 if (!
is_empty(line.substr(0, num_whitespaces))) {
71 throw std::runtime_error(
"Test nmodl input not correctly formatted");
74 line.erase(0, num_whitespaces);
75 indented_text += indent + line;
78 if (!stream.eof() && flag) {
79 indented_text +=
"\n";