test_string.cpp
Go to the documentation of this file.
1 // Bring in my package's API, which is what I'm testing
3 
4 // Bring in gtest
5 #include <gtest/gtest.h>
6 
7 
8 TEST(StringTest, stringconversion)
9 {
10  const std::string s1("123#1234567812345678");
11  can::Frame f1 = can::toframe(s1);
12  EXPECT_EQ(s1, can::tostring(f1, true));
13 
14  const std::string s2("1337#1234567812345678");
15  can::Frame f2 = can::toframe(s2);
16  EXPECT_FALSE(f2.isValid());
17 
18  const std::string s3("80001337#1234567812345678");
19  can::Frame f3 = can::toframe(s3);
20  EXPECT_EQ(s3, can::tostring(f3, true));
21 }
22 
23 // Run all the tests that were declared with TEST()
24 int main(int argc, char **argv){
25 testing::InitGoogleTest(&argc, argv);
26 return RUN_ALL_TESTS();
27 }
std::string tostring(const Header &h, bool lc)
Definition: string.cpp:77
int main(int argc, char **argv)
Definition: test_string.cpp:24
Frame toframe(const std::string &s)
Definition: string.cpp:114
TEST(StringTest, stringconversion)
Definition: test_string.cpp:8
bool isValid() const
Definition: interface.h:62


socketcan_interface
Author(s): Mathias Lüdtke
autogenerated on Sat May 4 2019 02:40:41