26 #include <gtest/gtest.h> 50 throw std::runtime_error(
"Failed to create tmpfile");
71 if (param_names[i][0] ==
'_' ||
skipKeys(i))
73 fprintf(
fp,
"%s: %f\n", param_names[i], i * 0.1 + 10.0);
82 if (param_names[i][0] ==
'_' ||
skipKeys(i))
84 ASSERT_DOUBLE_EQ(
p(static_cast<YPSpur_param>(i),
MOTOR_RIGHT), i * 0.1 + 10.0);
85 ASSERT_DOUBLE_EQ(
p(static_cast<YPSpur_param>(i),
MOTOR_LEFT), i * 0.1 + 10.0);
96 if (param_names[i][0] ==
'_' ||
skipKeys(i))
98 fprintf(
fp,
"%s[0]: %f\n", param_names[i], i * 0.1 + 10.0);
99 fprintf(
fp,
"%s[1]: %f\n", param_names[i], i * 0.1 + 100.0);
108 if (param_names[i][0] ==
'_' ||
skipKeys(i))
110 ASSERT_DOUBLE_EQ(
p(static_cast<YPSpur_param>(i),
MOTOR_RIGHT), i * 0.1 + 10.0);
111 ASSERT_DOUBLE_EQ(
p(static_cast<YPSpur_param>(i),
MOTOR_LEFT), i * 0.1 + 100.0);
122 if (param_names[i][0] ==
'_' ||
skipKeys(i))
124 fprintf(
fp,
"\n%s: %f", param_names[i], i * 0.1 + 10.0);
133 if (param_names[i][0] ==
'_' ||
skipKeys(i))
135 ASSERT_DOUBLE_EQ(
p(static_cast<YPSpur_param>(i),
MOTOR_RIGHT), i * 0.1 + 10.0);
136 ASSERT_DOUBLE_EQ(
p(static_cast<YPSpur_param>(i),
MOTOR_LEFT), i * 0.1 + 10.0);
144 fprintf(
fp,
"VERSION: 4.0\n");
145 fprintf(
fp,
"ENCODER_DENOMINATOR: 5.0\n");
148 if (param_names[i][0] ==
'_' ||
skipKeys(i))
150 fprintf(
fp,
"%s: %f\n", param_names[i], i * 0.1 + 10.0);
162 fprintf(
fp,
"ENCODER_DENOMINATOR: 5.0\n");
165 if (param_names[i][0] ==
'_' ||
skipKeys(i))
167 fprintf(
fp,
"%s: %f\n", param_names[i], i * 0.1 + 10.0);
178 int main(
int argc,
char **argv)
180 testing::InitGoogleTest(&argc, argv);
182 return RUN_ALL_TESTS();
TEST_F(ParamLoadTest, LeftRightCommon)
double p(YPSpur_param id, enum motor_id motor)
#define YP_PARAM_SUPPORTED_VERSION
int main(int argc, char **argv)
int set_paramptr(FILE *paramfile)
bool skipKeys(const int key)