Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
test.cpp
Go to the documentation of this file.
1#include "unity.h"
2#include "rpm.h"
3
4/*
5 * @brief Test case for sendRPM()
6 * check if the conversion is done correctly
7 */
8
10{
11 float rr_rpm = 126.23;
12 char rr_rpm_byte[4];
13 rpm_2_byte(rr_rpm, rr_rpm_byte);
14
15 int32_t RPMAux = (rr_rpm_byte[3] << 24) | (rr_rpm_byte[2] << 16) | (rr_rpm_byte[1] << 8) | rr_rpm_byte[0];
16
17 TEST_ASSERT_EQUAL(12623, RPMAux);
18}
19
20int main(int argc, char **argv)
21{
22 UNITY_BEGIN();
23 RUN_TEST(test_RRRPM_2_BYTE);
24 UNITY_END();
25
26 return 0;
27}
float rr_rpm
Definition main.cpp:80
void rpm_2_byte(float rr_rpm, char *rr_rpm_byte)
Definition rpm.h:12
void test_RRRPM_2_BYTE()
Definition test.cpp:9
int main()