5 #include <gtest/gtest.h> 13 #include "../src/DbcSignal.hpp" 19 std::istringstream in;
22 in.str(
"SG_ TEST : 8|1@1+ (1,0) [0|0] \"\" MAB");
24 ASSERT_FALSE(in.fail());
28 in.str(
"SG_ FEAT_BASE_ENABLED m0 : 16|1@1+ (1,0) [0|0] \"\" MAB");
30 ASSERT_FALSE(in.fail());
34 in.str(
"SG_ MUX M : 0|8@1+ (1,0) [0|0] \"\" MAB");
36 ASSERT_FALSE(in.fail());
40 in.str(
"SG_ DATE1 m129 : 24|8@1+ (1,0) [0|0] \"\" MAB");
42 ASSERT_FALSE(in.fail());
50 std::istringstream in;
53 in.str(
"SG_ TEST : 8|1@1+ (1,0) [0|0] \"\" MAB");
55 ASSERT_FALSE(in.fail());
56 EXPECT_EQ(sig.getName(),
"TEST");
57 EXPECT_EQ(sig.getMultiplexor(),
NONE);
59 EXPECT_EQ(sig.getStartbit(), 8);
60 EXPECT_EQ(sig.getLength(), 1);
61 EXPECT_EQ(sig.getByteOrder(),
INTEL);
63 EXPECT_EQ(sig.getFactor(), 1);
64 EXPECT_EQ(sig.getOffset(), 0);
65 EXPECT_EQ(sig.getMinimum(), 0);
66 EXPECT_EQ(sig.getMaximum(), 0);
67 EXPECT_EQ(sig.getUnit(),
"");
72 in.str(
"SG_ FEAT_BASE_ENABLED m0 : 16|1@1+ (1,0) [0|0] \"\" MAB");
74 ASSERT_FALSE(in.fail());
75 EXPECT_EQ(sig.getName(),
"FEAT_BASE_ENABLED");
77 EXPECT_EQ(sig.getMultiplexedNumber(), 0);
78 EXPECT_EQ(sig.getStartbit(), 16);
79 EXPECT_EQ(sig.getLength(), 1);
80 EXPECT_EQ(sig.getByteOrder(),
INTEL);
82 EXPECT_EQ(sig.getFactor(), 1);
83 EXPECT_EQ(sig.getOffset(), 0);
84 EXPECT_EQ(sig.getMinimum(), 0);
85 EXPECT_EQ(sig.getMaximum(), 0);
86 EXPECT_EQ(sig.getUnit(),
"");
91 in.str(
"SG_ MUX M : 0|8@1+ (1,0) [0|0] \"\" MAB");
93 ASSERT_FALSE(in.fail());
94 EXPECT_EQ(sig.getName(),
"MUX");
97 EXPECT_EQ(sig.getStartbit(), 0);
98 EXPECT_EQ(sig.getLength(), 8);
99 EXPECT_EQ(sig.getByteOrder(),
INTEL);
101 EXPECT_EQ(sig.getFactor(), 1);
102 EXPECT_EQ(sig.getOffset(), 0);
103 EXPECT_EQ(sig.getMinimum(), 0);
104 EXPECT_EQ(sig.getMaximum(), 0);
105 EXPECT_EQ(sig.getUnit(),
"");
110 in.str(
"SG_ DATE1 m129 : 24|8@1+ (1,0) [0|0] \"\" MAB");
112 ASSERT_FALSE(in.fail());
113 EXPECT_EQ(sig.getName(),
"DATE1");
115 EXPECT_EQ(sig.getMultiplexedNumber(), 129);
116 EXPECT_EQ(sig.getStartbit(), 24);
117 EXPECT_EQ(sig.getLength(), 8);
118 EXPECT_EQ(sig.getByteOrder(),
INTEL);
120 EXPECT_EQ(sig.getFactor(), 1);
121 EXPECT_EQ(sig.getOffset(), 0);
122 EXPECT_EQ(sig.getMinimum(), 0);
123 EXPECT_EQ(sig.getMaximum(), 0);
124 EXPECT_EQ(sig.getUnit(),
"");
129 int main(
int argc,
char **argv)
131 testing::InitGoogleTest(&argc, argv);
132 return RUN_ALL_TESTS();
int main(int argc, char **argv)