-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from spacelab-ufsc/feat_unit_tests
Add unit test structure files for the following devices: OBDH; TTC; Voltage sensor; Temp sensor; Current sensor The related issues (#147, #146, #150, #149 and #148 respectively) are not being closed, given that the tests are not properly implemented, as the files are templates only.
- Loading branch information
Showing
26 changed files
with
1,310 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* current_sensor_test.c | ||
* | ||
* Copyright (C) 2021, SpaceLab. | ||
* | ||
* This file is part of EPS 2.0. | ||
* | ||
* EPS 2.0 is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* EPS 2.0 is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with EPS 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
/** | ||
* \brief Unit test of the Current Sensor device | ||
* | ||
* \author Lucas Zacchi de Medeiros <[email protected]> | ||
* | ||
* \version 0.1.0 | ||
* | ||
* \date 2021/08/23 | ||
* | ||
* \defgroup current_sensor_test Current Sensor | ||
* \ingroup tests | ||
* \{ | ||
*/ | ||
|
||
#include <stdarg.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <setjmp.h> | ||
#include <float.h> | ||
#include <cmocka.h> | ||
|
||
#include <devices/current_sensor/current_sensor.h> | ||
#include <system/sys_log/sys_log.h> | ||
#include <drivers/adc/adc.h> | ||
#include <drivers/max9934/max9934.h> | ||
|
||
static void current_sensor_init_test(void **state) { | ||
|
||
} | ||
|
||
static void current_sensor_raw_read_test(void **state) { | ||
|
||
} | ||
|
||
int main(void) { | ||
const struct CMUnitTest current_sensor_tests[] = { | ||
cmocka_unit_test(current_sensor_init_test), | ||
cmocka_unit_test(current_sensor_raw_read_test), | ||
}; | ||
|
||
return cmocka_run_group_tests(current_sensor_tests, NULL, NULL); | ||
} | ||
|
||
|
||
/** \} End of current_sensor_test group */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* obdh_test.c | ||
* | ||
* Copyright (C) 2021, SpaceLab. | ||
* | ||
* This file is part of EPS 2.0. | ||
* | ||
* EPS 2.0 is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* EPS 2.0 is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with EPS 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
/** | ||
* \brief Unit test of the OBDH device. | ||
* | ||
* \author Lucas Zacchi de Medeiros <[email protected]> | ||
* | ||
* \version 0.1.0 | ||
* | ||
* \date 2021/09/15 | ||
* | ||
* \defgroup obdh_unit_test OBDH | ||
* \ingroup tests | ||
* \{ | ||
*/ | ||
|
||
#include <stdarg.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <setjmp.h> | ||
#include <float.h> | ||
#include <cmocka.h> | ||
|
||
#include <devices/obdh/obdh.h> | ||
#include <drivers/tca4311a/tca4311a.h> | ||
#include <drivers/i2c_slave/i2c_slave.h> | ||
#include <drivers/i2c/i2c.h> | ||
|
||
static void obdh_init_test(void** state) { | ||
|
||
} | ||
|
||
static void obdh_decocde_test(void **state) { | ||
|
||
} | ||
|
||
static void obdh_answer_test(void** state) { | ||
|
||
} | ||
|
||
int main(void) { | ||
const struct CMUnitTest obdh_tests[] = { | ||
cmocka_unit_test(obdh_init_test), | ||
cmocka_unit_test(obdh_decocde_test), | ||
cmocka_unit_test(obdh_answer_test), | ||
|
||
}; | ||
|
||
return cmocka_run_group_tests(obdh_tests, NULL, NULL); | ||
} | ||
|
||
/** \} End of obdh_test group */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* temp_sensor_test.c | ||
* | ||
* Copyright (C) 2021, SpaceLab. | ||
* | ||
* This file is part of EPS 2.0. | ||
* | ||
* EPS 2.0 is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* EPS 2.0 is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with EPS 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
/** | ||
* \brief Unit test of the Temp Sensor device. | ||
* | ||
* \author Lucas Zacchi de Medeiros <[email protected]> | ||
* | ||
* \version 0.1.0 | ||
* | ||
* \date 2021/09/06 | ||
* | ||
* \defgroup leds_unit_test LEDs | ||
* \ingroup tests | ||
* \{ | ||
*/ | ||
|
||
#include <stdarg.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <setjmp.h> | ||
#include <float.h> | ||
#include <cmocka.h> | ||
|
||
#include <devices/temp_sensor/temp_sensor.h> | ||
#include <drivers/ads1248/ads1248.h> | ||
|
||
static void temp_sensor_init_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_sensor_suspend_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_mcu_read_raw_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_mcu_raw_to_c_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_mcu_raw_to_k_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_mcu_read_c_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_mcu_read_k_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_rtd_read_raw_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_rtd_raw_to_c_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_rtd_raw_to_k_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_rtd_read_c_test(void **state) { | ||
|
||
} | ||
|
||
static void temp_rtd_read_k_test(void **state) { | ||
|
||
} | ||
|
||
int main(void) { | ||
const struct CMUnitTest temp_sensor_tests[] = { | ||
cmocka_unit_test(temp_sensor_init_test), | ||
cmocka_unit_test(temp_sensor_suspend_test), | ||
cmocka_unit_test(temp_mcu_read_raw_test), | ||
cmocka_unit_test(temp_mcu_raw_to_c_test), | ||
cmocka_unit_test(temp_mcu_raw_to_k_test), | ||
cmocka_unit_test(temp_mcu_read_c_test), | ||
cmocka_unit_test(temp_mcu_read_k_test), | ||
cmocka_unit_test(temp_rtd_read_raw_test), | ||
cmocka_unit_test(temp_rtd_raw_to_c_test), | ||
cmocka_unit_test(temp_rtd_raw_to_k_test), | ||
cmocka_unit_test(temp_rtd_read_c_test), | ||
cmocka_unit_test(temp_rtd_read_k_test) | ||
}; | ||
|
||
return cmocka_run_group_tests(temp_sensor_tests, NULL, NULL); | ||
} |
Oops, something went wrong.