Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
8cc261a1
Commit
8cc261a1
authored
8 years ago
by
Lorenz Meier
Committed by
Daniel Agar
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Slight improvements in unit tests
parent
bae3f369
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/modules/unit_test/unit_test.cpp
+3
-3
3 additions, 3 deletions
src/modules/unit_test/unit_test.cpp
src/modules/unit_test/unit_test.h
+14
-0
14 additions, 0 deletions
src/modules/unit_test/unit_test.h
with
17 additions
and
3 deletions
src/modules/unit_test/unit_test.cpp
+
3
−
3
View file @
8cc261a1
...
...
@@ -57,9 +57,9 @@ void UnitTest::print_results(void)
PX4_INFO
(
"ALL TESTS PASSED"
);
}
PX4_INFO
(
" Tests passed : %d"
,
_tests_passed
);
PX4_INFO
(
" Tests failed : %d"
,
_tests_failed
);
PX4_INFO
(
"
A
ssertions : %d"
,
_assertions
);
PX4_INFO
(
" Tests passed :
%d"
,
_tests_passed
);
PX4_INFO
(
" Tests failed :
%d"
,
_tests_failed
);
PX4_INFO
(
"
Tested a
ssertions : %d"
,
_assertions
);
}
/// @brief Used internally to the ut_assert macro to print assert failures.
...
...
This diff is collapsed.
Click to expand it.
src/modules/unit_test/unit_test.h
+
14
−
0
View file @
8cc261a1
...
...
@@ -158,6 +158,20 @@ protected:
} \
} while (0)
/// @brief Used to compare two integer values within a unit test. If possible use ut_less_than instead of ut_assert
/// since it will give you better error reporting of the actual values being compared.
#define ut_less_than(message, v1_smaller, v2_bigger) \
do { \
int _v1 = v1_smaller; \
int _v2 = v2_bigger; \
if (!(_v1 < _v2)) { \
_print_compare(message, #v1_smaller, _v1, #v2_bigger, _v2, __FILE__, __LINE__); \
return false; \
} else { \
_assertions++; \
} \
} while (0)
virtual
void
_init
(
void
)
{
};
///< Run before each unit test. Override to provide custom behavior.
virtual
void
_cleanup
(
void
)
{
};
///< Run after each unit test. Override to provide custom behavior.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment