starts_with_test.cpp
Go to the documentation of this file.
2 #include <gtest/gtest.h>
3 #include <string>
4 
5 void expect_starts(const std::string& p, const std::string& s, bool cond) {
6  if (cond)
7  EXPECT_TRUE(stan::io::starts_with(p, s));
8  else
9  EXPECT_FALSE(stan::io::starts_with(p, s));
10 }
11 
12 TEST(Io, StartsWith) {
13  expect_starts("", "", true);
14  expect_starts("", "a", true);
15  expect_starts("abc", "abc", true);
16  expect_starts("abc", "abcd", true);
17 
18  expect_starts("a", "", false);
19  expect_starts("abc", "ab", false);
20 }
const char * p
Definition: xmltok.h:285
bool starts_with(const std::string &p, const std::string &s)
Definition: starts_with.hpp:17
const XML_Char * s
Definition: expat.h:262
TEST(Io, StartsWith)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
void expect_starts(const std::string &p, const std::string &s, bool cond)