Skip to content

Commit a021cb3

Browse files
committed
tests: drivers: power: max17616: Add unit tests for max17616
Add unit test files for the max17616 driver. Signed-off-by: Carlos Jones <[email protected]>
1 parent c0e41f5 commit a021cb3

File tree

8 files changed

+4385
-0
lines changed

8 files changed

+4385
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
:project:
3+
:use_exceptions: FALSE
4+
:use_test_preprocessor: :all
5+
:use_auxiliary_dependencies: TRUE
6+
:build_root: build
7+
# :release_build: TRUE
8+
:test_file_prefix: test_
9+
:which_ceedling: gem
10+
:ceedling_version: 1.0.1
11+
:default_tasks:
12+
- test:all
13+
14+
:environment:
15+
16+
:extension:
17+
:executable: .out
18+
19+
:paths:
20+
:test:
21+
- test
22+
:source:
23+
- ../../../../drivers/power/max17616/
24+
:include:
25+
- ../../../../include/**
26+
- ../../../../drivers/power/max17616/**
27+
- ../../../../iio/**
28+
:support:
29+
- test/support
30+
:libraries: []
31+
32+
:files:
33+
:test:
34+
- test/test_max17616.c
35+
- test/test_iio_max17616.c
36+
:source:
37+
- ../../../../drivers/power/max17616/max17616.c
38+
- ../../../../drivers/power/max17616/iio_max17616.c
39+
:support:
40+
- test/support/test_max17616_support.c
41+
- test/support/test_iio_max17616_support.c
42+
43+
:defines:
44+
# Original driver specific defines
45+
:common: &common_defines []
46+
:test:
47+
- *common_defines
48+
- TEST
49+
:test_preprocess:
50+
- *common_defines
51+
- TEST
52+
53+
:cmock:
54+
:mock_prefix: mock_
55+
:when_no_prototypes: :warn
56+
:callback_include_count: TRUE
57+
:callback_after_arg_check: TRUE
58+
:enforce_strict_ordering: TRUE
59+
:plugins:
60+
- :ignore
61+
- :callback
62+
:treat_as:
63+
uint8: HEX8
64+
uint16: HEX16
65+
uint32: UINT32
66+
int8: INT8
67+
bool: UINT8
68+
69+
# Add -gcov to the plugins list to make sure of the gcov plugin
70+
# You will need to have gcov and gcovr both installed to make it work.
71+
# For more information on these options, see docs in plugins/gcov
72+
:gcov:
73+
:reports:
74+
- HtmlDetailed
75+
:gcovr:
76+
:html_medium_threshold: 75
77+
:html_high_threshold: 90
78+
:report_include: "../../../../drivers/power/max17616/.*"
79+
80+
#:tools:
81+
# Ceedling defaults to using gcc for compiling, linking, etc.
82+
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
83+
# See documentation to configure a given toolchain for use
84+
85+
# LIBRARIES
86+
# These libraries are automatically injected into the build process. Those specified as
87+
# common will be used in all types of builds. Otherwise, libraries can be injected in just
88+
# tests or releases. These options are MERGED with the options in supplemental yaml files.
89+
:libraries:
90+
:placement: :end
91+
:flag: "-l${1}"
92+
:path_flag: "-L ${1}"
93+
:system: [] # for example, you might list 'm' to grab the math library
94+
:test: []
95+
:release: []
96+
97+
:junit_tests_report:
98+
:artifact_filename: report_junit_original.xml
99+
100+
:plugins:
101+
:enabled:
102+
- report_tests_pretty_stdout
103+
- module_generator
104+
- report_tests_raw_output_log
105+
- gcov
106+
- report_tests_log_factory
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/***************************************************************************//**
2+
* @file test_iio_max17616_support.c
3+
* @brief Support implementation for MAX17616 IIO Driver unit tests
4+
* @author Carlos Jones ([email protected])
5+
*******************************************************************************
6+
* Copyright 2025(c) Analog Devices, Inc.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright notice,
12+
* this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution.
17+
*
18+
* 3. Neither the name of Analog Devices, Inc. nor the names of its
19+
* contributors may be used to endorse or promote products derived from this
20+
* software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. "AS IS" AND ANY EXPRESS OR
23+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25+
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
******************************************************************************/
33+
34+
/*******************************************************************************
35+
* INCLUDED FILES
36+
******************************************************************************/
37+
38+
#include "test_iio_max17616_support.h"
39+
40+
/*******************************************************************************
41+
* FUNCTION IMPLEMENTATIONS
42+
******************************************************************************/
43+
44+
/**
45+
* @brief Setup function for IIO MAX17616 tests
46+
*/
47+
void iio_max17616_test_setup(void)
48+
{
49+
// Any test setup code can go here
50+
// Currently no specific setup needed
51+
}
52+
53+
/**
54+
* @brief Teardown function for IIO MAX17616 tests
55+
*/
56+
void iio_max17616_test_teardown(void)
57+
{
58+
// Any test teardown code can go here
59+
// Currently no specific teardown needed
60+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/***************************************************************************//**
2+
* @file test_iio_max17616_support.h
3+
* @brief Support header for MAX17616 IIO Driver unit tests
4+
* @author Carlos Jones ([email protected])
5+
*******************************************************************************
6+
* Copyright 2025(c) Analog Devices, Inc.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright notice,
12+
* this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution.
17+
*
18+
* 3. Neither the name of Analog Devices, Inc. nor the names of its
19+
* contributors may be used to endorse or promote products derived from this
20+
* software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. "AS IS" AND ANY EXPRESS OR
23+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25+
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
******************************************************************************/
33+
34+
#ifndef TEST_IIO_MAX17616_SUPPORT_H_
35+
#define TEST_IIO_MAX17616_SUPPORT_H_
36+
37+
/*******************************************************************************
38+
* FUNCTION DECLARATIONS
39+
******************************************************************************/
40+
41+
/**
42+
* @brief Setup function for IIO MAX17616 tests
43+
*/
44+
void iio_max17616_test_setup(void);
45+
46+
/**
47+
* @brief Teardown function for IIO MAX17616 tests
48+
*/
49+
void iio_max17616_test_teardown(void);
50+
51+
#endif /* TEST_IIO_MAX17616_SUPPORT_H_ */

0 commit comments

Comments
 (0)