5 #include <gtest/gtest.h> 13 #include "../src/DbcMessage.hpp" 19 std::istringstream in;
21 std::string input =
"BO_ 126 License: 8 EPAS\n";
22 input +=
" SG_ EXPIRED : 10|1@1+ (1,0) [0|0] \"\" MAB\n";
23 input +=
" SG_ MUX M : 0|8@1+ (1,0) [0|0] \"\" MAB\n";
24 input +=
" SG_ FEAT_BASE_TRIALS_USED m0 : 32|16@1+ (1,0) [0|0] \"\" MAB\n";
25 input +=
" SG_ DATE1 m129 : 24|8@1+ (1,0) [0|0] \"\" MAB";
28 ASSERT_FALSE(in.fail());
36 std::istringstream in;
38 std::string input =
"BO_ 126 License: 8 EPAS\n";
39 input +=
" SG_ EXPIRED : 10|1@1+ (1,0) [0|0] \"\" MAB\n";
40 input +=
" SG_ MUX M : 0|8@1+ (1,0) [0|0] \"\" MAB\n";
41 input +=
" SG_ FEAT_BASE_TRIALS_USED m0 : 32|16@1+ (1,0) [0|0] \"\" MAB\n";
42 input +=
" SG_ DATE1 m129 : 24|8@1+ (1,0) [0|0] \"\" MAB";
45 ASSERT_FALSE(in.fail());
47 EXPECT_EQ(msg.getId(), 126u);
48 EXPECT_EQ(msg.getName(),
"License");
49 EXPECT_EQ(msg.getDlc(), 8u);
50 EXPECT_EQ(msg.getFrom(),
"EPAS");
52 EXPECT_EQ(msg[0].
getName(),
"EXPIRED");
53 EXPECT_EQ(msg[0].getMultiplexor(),
NONE);
55 EXPECT_EQ(msg[0].getStartbit(), 10);
56 EXPECT_EQ(msg[0].getLength(), 1);
57 EXPECT_EQ(msg[0].getByteOrder(),
INTEL);
58 EXPECT_EQ(msg[0].getSign(),
UNSIGNED);
59 EXPECT_EQ(msg[0].getFactor(), 1);
60 EXPECT_EQ(msg[0].getOffset(), 0);
61 EXPECT_EQ(msg[0].getMinimum(), 0);
62 EXPECT_EQ(msg[0].getMaximum(), 0);
63 EXPECT_EQ(msg[0].getUnit(),
"");
66 EXPECT_EQ(msg[1].
getName(),
"MUX");
69 EXPECT_EQ(msg[1].getStartbit(), 0);
70 EXPECT_EQ(msg[1].getLength(), 8);
71 EXPECT_EQ(msg[1].getByteOrder(),
INTEL);
72 EXPECT_EQ(msg[1].getSign(),
UNSIGNED);
73 EXPECT_EQ(msg[1].getFactor(), 1);
74 EXPECT_EQ(msg[1].getOffset(), 0);
75 EXPECT_EQ(msg[1].getMinimum(), 0);
76 EXPECT_EQ(msg[1].getMaximum(), 0);
77 EXPECT_EQ(msg[1].getUnit(),
"");
80 EXPECT_EQ(msg[2].
getName(),
"FEAT_BASE_TRIALS_USED");
82 EXPECT_EQ(msg[2].getMultiplexedNumber(), 0);
83 EXPECT_EQ(msg[2].getStartbit(), 32);
84 EXPECT_EQ(msg[2].getLength(), 16);
85 EXPECT_EQ(msg[2].getByteOrder(),
INTEL);
86 EXPECT_EQ(msg[2].getSign(),
UNSIGNED);
87 EXPECT_EQ(msg[2].getFactor(), 1);
88 EXPECT_EQ(msg[2].getOffset(), 0);
89 EXPECT_EQ(msg[2].getMinimum(), 0);
90 EXPECT_EQ(msg[2].getMaximum(), 0);
91 EXPECT_EQ(msg[2].getUnit(),
"");
94 EXPECT_EQ(msg[3].
getName(),
"DATE1");
96 EXPECT_EQ(msg[3].getMultiplexedNumber(), 129);
97 EXPECT_EQ(msg[3].getStartbit(), 24);
98 EXPECT_EQ(msg[3].getLength(), 8);
99 EXPECT_EQ(msg[3].getByteOrder(),
INTEL);
100 EXPECT_EQ(msg[3].getSign(),
UNSIGNED);
101 EXPECT_EQ(msg[3].getFactor(), 1);
102 EXPECT_EQ(msg[3].getOffset(), 0);
103 EXPECT_EQ(msg[3].getMinimum(), 0);
104 EXPECT_EQ(msg[3].getMaximum(), 0);
105 EXPECT_EQ(msg[3].getUnit(),
"");
111 int main(
int argc,
char **argv)
113 testing::InitGoogleTest(&argc, argv);
114 return RUN_ALL_TESTS();
int main(int argc, char **argv)
std::string getName(void *handle)