-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add simple tests for as5600 and fix missing inlcludes
- Loading branch information
1 parent
8922ff0
commit ab3eb50
Showing
7 changed files
with
142 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- '*' | ||
jobs: | ||
tests: | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
|
||
- name: Install gtest | ||
run: | | ||
wget https://gist.githubusercontent.com/Ponomarevda/d970c24de8deab5d6ccfee8f5f719bcc/raw/install_gtest_ubuntu.sh && chmod +x install_gtest_ubuntu.sh && ./install_gtest_ubuntu.sh | ||
- name: Build and run tests | ||
run: make tests |
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
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,28 @@ | ||
# Copyright (C) 2024 Dmitry Ponomarev <[email protected]> | ||
# Distributed under the terms of the GPL v3 license, available in the file LICENSE. | ||
|
||
cmake_minimum_required(VERSION 3.10) | ||
project(as5600) | ||
|
||
add_library(as5600 | ||
../as5600.cpp | ||
../../Src/platform/ubuntu/i2c.cpp | ||
) | ||
|
||
target_include_directories(as5600 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
find_package(GTest REQUIRED) | ||
include_directories( | ||
${GTEST_INCLUDE_DIRS} | ||
../../../../Src | ||
) | ||
|
||
add_executable(test_as5600 | ||
test_as5600.cpp | ||
) | ||
|
||
target_link_libraries(test_as5600 | ||
as5600 | ||
GTest::GTest | ||
GTest::Main | ||
) |
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,42 @@ | ||
/** | ||
* This program is free software under the GNU General Public License v3. | ||
* See <https://www.gnu.org/licenses/> for details. | ||
* Author: Dmitry Ponomarev <[email protected]> | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
#include "drivers/as5600/as5600.hpp" | ||
|
||
TEST(AS5600Test, HelloWorld) { | ||
EXPECT_EQ(1, 1); | ||
} | ||
|
||
TEST(AS5600Test, init) { | ||
Driver::AS5600 as5600; | ||
as5600.init(); | ||
} | ||
|
||
TEST(AS5600Test, is_ready) { | ||
Driver::AS5600 as5600; | ||
as5600.is_ready(); | ||
} | ||
|
||
TEST(AS5600Test, get_angle) { | ||
Driver::AS5600 as5600; | ||
as5600.get_angle(); | ||
} | ||
|
||
TEST(AS5600Test, get_magnitude) { | ||
Driver::AS5600 as5600; | ||
as5600.get_magnitude(); | ||
} | ||
|
||
TEST(AS5600Test, get_status) { | ||
Driver::AS5600 as5600; | ||
as5600.get_status(); | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |
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