test_strings.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2024 The urg_stamped Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <gtest/gtest.h>
18 
19 #include <string>
20 #include <vector>
21 
22 #include <urg_stamped/strings.h>
23 
24 TEST(Strings, Split)
25 {
26  const std::string in("1.23.456");
27  const std::vector<std::string> out = urg_stamped::strings::split(in, '.');
28  ASSERT_EQ(out.size(), 3);
29  ASSERT_EQ(out[0], std::string("1"));
30  ASSERT_EQ(out[1], std::string("23"));
31  ASSERT_EQ(out[2], std::string("456"));
32 }
33 
34 int main(int argc, char** argv)
35 {
36  testing::InitGoogleTest(&argc, argv);
37 
38  return RUN_ALL_TESTS();
39 }
urg_stamped::strings::split
std::vector< std::string > split(const std::string &s, const char delim)
Definition: strings.h:28
TEST
TEST(Strings, Split)
Definition: test_strings.cpp:24
strings.h
main
int main(int argc, char **argv)
Definition: test_strings.cpp:34


urg_stamped
Author(s): Atsushi Watanabe
autogenerated on Wed Dec 18 2024 03:10:57