From ef81a2014004bc5a6bd8df19f9edd105a122db2b Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Wed, 18 Jul 2018 13:51:01 -0700 Subject: [PATCH] gtest: Added headers to unit tests Added missing headers for the C++ unit tests. Signed-off-by: Noel Eck --- tests/unit/json/json_tests.cxx | 32 ++++++++++++++++++----- tests/unit/nmea_gps/nmea_gps_tests.cxx | 24 +++++++++++++++++ tests/unit/utilities/utilities_tests.cxx | 33 ++++++++++++++++++------ 3 files changed, 74 insertions(+), 15 deletions(-) diff --git a/tests/unit/json/json_tests.cxx b/tests/unit/json/json_tests.cxx index 3bb401d5..ed68ff95 100644 --- a/tests/unit/json/json_tests.cxx +++ b/tests/unit/json/json_tests.cxx @@ -1,3 +1,28 @@ +/* + * Author: Noel Eck + * Copyright (c) 2018 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + #include "gtest/gtest.h" #include "external/json/json.hpp" @@ -77,10 +102,3 @@ TEST_F(json_unit, test_basic_class_serialization) std::map clone_sources = j_sources; ASSERT_EQ(sources, j_sources); } - -/* Currently no need for a custom main (use gtest's) -int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -*/ diff --git a/tests/unit/nmea_gps/nmea_gps_tests.cxx b/tests/unit/nmea_gps/nmea_gps_tests.cxx index 022ebb40..5f4cd685 100644 --- a/tests/unit/nmea_gps/nmea_gps_tests.cxx +++ b/tests/unit/nmea_gps/nmea_gps_tests.cxx @@ -1,3 +1,27 @@ +/* + * Author: Noel Eck + * Copyright (c) 2018 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + #include "gtest/gtest.h" #include "nmea_gps.hpp" #include "mraa.hpp" diff --git a/tests/unit/utilities/utilities_tests.cxx b/tests/unit/utilities/utilities_tests.cxx index 2c57a62c..dba0063e 100644 --- a/tests/unit/utilities/utilities_tests.cxx +++ b/tests/unit/utilities/utilities_tests.cxx @@ -1,3 +1,28 @@ +/* + * Author: Noel Eck + * Copyright (c) 2018 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + #include "gtest/gtest.h" #include "upm_utilities.h" #include "upm_utilities.hpp" @@ -60,11 +85,3 @@ TEST_F(utilities_unit, test_upm_delay_us) /* +- check for 1000us +/- 150us */ ASSERT_NEAR(upm_elapsed_us(&clock), 1000, 150); } - -/* Currently no need for a custom main (use gtest's) -int main(int argc, char **argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -*/