diff --git a/.github/workflows/compile-all-batteries.yml b/.github/workflows/compile-all-batteries.yml index c0c1493e..dcb9a1f6 100644 --- a/.github/workflows/compile-all-batteries.yml +++ b/.github/workflows/compile-all-batteries.yml @@ -2,11 +2,7 @@ name: Compile All Batteries # Here we tell GitHub when to run the workflow. -on: - # The workflow is run when a commit is pushed or for a - # Pull Request. - - push - - pull_request +on: [push, pull_request] # This is the list of jobs that will be run concurrently. # Since we use a build matrix, the actual number of jobs diff --git a/.github/workflows/compile-all-inverters.yml b/.github/workflows/compile-all-inverters.yml index 954e263c..f33f0d26 100644 --- a/.github/workflows/compile-all-inverters.yml +++ b/.github/workflows/compile-all-inverters.yml @@ -2,11 +2,7 @@ name: Compile All Inverters # Here we tell GitHub when to run the workflow. -on: - # The workflow is run when a commit is pushed or for a - # Pull Request. - - push - - pull_request +on: [push, pull_request] # This is the list of jobs that will be run concurrently. # Since we use a build matrix, the actual number of jobs diff --git a/.github/workflows/run-pre-commit.yml b/.github/workflows/run-pre-commit.yml index e23a9655..aedd71f8 100644 --- a/.github/workflows/run-pre-commit.yml +++ b/.github/workflows/run-pre-commit.yml @@ -2,9 +2,7 @@ name: Run pre-commit -on: - - push - - pull_request +on: [push, pull_request] jobs: pre-commit: diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 1381259a..4ca1782d 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,6 +1,6 @@ name: Run Unit Tests -on: [push] +on: [push, pull_request] jobs: build: @@ -19,5 +19,6 @@ jobs: - name: Run unit tests run: | + set -e # Exit immediately on non-zero exit code cd build/test find . -type f -executable -exec {} \; diff --git a/Software/src/devboard/utils/CMakeLists.txt b/Software/src/devboard/utils/CMakeLists.txt new file mode 100644 index 00000000..bded7cb0 --- /dev/null +++ b/Software/src/devboard/utils/CMakeLists.txt @@ -0,0 +1 @@ +# add_library(utils_library events.cpp) diff --git a/test/utils/timer_test.cpp b/test/utils/timer_test.cpp index 96e9b142..52c64f13 100644 --- a/test/utils/timer_test.cpp +++ b/test/utils/timer_test.cpp @@ -9,24 +9,32 @@ TEST(timer_test) { unsigned long test_interval = 10; + bool result; - testlib_millis = 0; + testlib_millis = 30; MyTimer timer(test_interval); - ASSERT_EQ(timer.elapsed(), false); + result = timer.elapsed(); + ASSERT_EQ(result, false); - testlib_millis = test_interval - 1; - ASSERT_EQ(timer.elapsed(), false); + testlib_millis += test_interval - 1; + result = timer.elapsed(); + ASSERT_EQ(result, false); - testlib_millis = test_interval; - ASSERT_EQ(timer.elapsed(), true); - ASSERT_EQ(timer.elapsed(), false); + testlib_millis += 1; + result = timer.elapsed(); + ASSERT_EQ(result, true); + result = timer.elapsed(); + ASSERT_EQ(result, false); - testlib_millis = 2 * test_interval - 1; - ASSERT_EQ(timer.elapsed(), false); + testlib_millis += test_interval - 1; + result = timer.elapsed(); + ASSERT_EQ(result, false); - testlib_millis = 2 * test_interval; - ASSERT_EQ(timer.elapsed(), true); - ASSERT_EQ(timer.elapsed(), false); + testlib_millis += 1; + result = timer.elapsed(); + ASSERT_EQ(result, true); + result = timer.elapsed(); + ASSERT_EQ(result, true); // Injected fault to catch unit test errors } TEST_MAIN();