Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embedded_scheduler -> olg_scheduler #3

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2024 Zubax Robotics <[email protected]>

cmake_minimum_required(VERSION 3.12)
project(embedded_scheduler_tests C CXX)
project(olg_scheduler_tests C CXX)
enable_testing()

set(CTEST_OUTPUT_ON_FAILURE ON)
Expand Down Expand Up @@ -49,15 +49,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion -Wcast-align -Wmissing
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wtype-limits -Wnon-virtual-dtor -Woverloaded-virtual")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")

add_executable(test_embedded_scheduler_cpp20 ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_embedded_scheduler.cpp)
set_target_properties(test_embedded_scheduler_cpp20 PROPERTIES CXX_STANDARD 20)
target_include_directories(test_embedded_scheduler_cpp20 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(test_embedded_scheduler_cpp20 SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib)
target_link_libraries(test_embedded_scheduler_cpp20
add_executable(test_olg_scheduler_cpp20 ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_olg_scheduler.cpp)
set_target_properties(test_olg_scheduler_cpp20 PROPERTIES CXX_STANDARD 20)
target_include_directories(test_olg_scheduler_cpp20 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(test_olg_scheduler_cpp20 SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib)
target_link_libraries(test_olg_scheduler_cpp20
PRIVATE
GTest::gmock_main
)

#add_test("run_test_embedded_scheduler_cpp20" "test_embedded_scheduler_cpp20")
include(GoogleTest)
gtest_discover_tests(test_embedded_scheduler_cpp20)
gtest_discover_tests(test_olg_scheduler_cpp20)
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# embedded_scheduler
# olg_scheduler

[![Main Workflow](https://github.com/serges147/embedded_scheduler/actions/workflows/main.yml/badge.svg)](https://github.com/serges147/embedded_scheduler/actions/workflows/main.yml)

Generic single-file implementation of scheduler suitable for deeply embedded systems.
**Simply copy `embedded_scheduler.hpp` into your project tree
and you are ready to roll.**
"OLG" happens to be an abbreviation of Okay Let's Go
and also a reference to the fact that it has a logarithmic asymptotic complexity.
**Simply copy `olg_scheduler/scheduler.hpp` into your project tree and you are ready to roll.**
The usage instructions are provided in the comments.
The code is fully covered by manual tests with full state space exploration.

Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

- [ ] Search for...
- [ ] "serge"
- [ ] "embedded" -> "olg"

- [ ] Replace "serges147" with proper organization name when ready
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <optional>
#include <variant>

namespace embedded_scheduler
namespace olg_scheduler
{

template <typename TimePoint>
Expand Down Expand Up @@ -350,4 +350,4 @@ class EventLoop final

}; // EventLoop

} // namespace embedded_scheduler
} // namespace olg_scheduler
19 changes: 10 additions & 9 deletions tests/test_embedded_scheduler.cpp → tests/test_olg_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/// 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 "embedded_scheduler/scheduler.hpp"
#include "olg_scheduler/scheduler.hpp"

#include <gmock/gmock.h>
#include <gtest/gtest.h>
Expand Down Expand Up @@ -70,9 +70,10 @@ class SteadyClockMock final

} // namespace

namespace embedded_scheduler::verification
namespace olg_scheduler::verification
{
TEST(TestEmbeddedScheduler, EventLoopBasic)

TEST(TestOlgScheduler, EventLoopBasic)
{
using std::chrono_literals::operator""ms;

Expand Down Expand Up @@ -255,7 +256,7 @@ TEST(TestEmbeddedScheduler, EventLoopBasic)
// semihost::log("Alloc after dtors: ", platform::heap::getDiagnostics().allocated);
}

TEST(TestEmbeddedScheduler, EventLoopTotalOrdering)
TEST(TestOlgScheduler, EventLoopTotalOrdering)
{
using std::chrono_literals::operator""ms;

Expand Down Expand Up @@ -297,7 +298,7 @@ TEST(TestEmbeddedScheduler, EventLoopTotalOrdering)
EXPECT_THAT(c, 5);
}

TEST(TestEmbeddedScheduler, EventLoopPoll)
TEST(TestOlgScheduler, EventLoopPoll)
{
using time_point = SteadyClockMock::time_point;
using std::chrono_literals::operator""ms;
Expand Down Expand Up @@ -333,7 +334,7 @@ TEST(TestEmbeddedScheduler, EventLoopPoll)
EXPECT_THAT(evl.getTree()[0U]->getDeadline().value().time_since_epoch(), 210ms); // Skipped ahead!
}

TEST(TestEmbeddedScheduler, EventLoopDefer_single_overdue)
TEST(TestOlgScheduler, EventLoopDefer_single_overdue)
{
using time_point = SteadyClockMock::time_point;
using std::chrono_literals::operator""ms;
Expand All @@ -352,7 +353,7 @@ TEST(TestEmbeddedScheduler, EventLoopDefer_single_overdue)
EXPECT_THAT(out.approx_now.time_since_epoch(), 1030ms);
}

TEST(TestEmbeddedScheduler, EventLoopDefer_long_running_callback)
TEST(TestOlgScheduler, EventLoopDefer_long_running_callback)
{
using duration = SteadyClockMock::duration;
using std::chrono_literals::operator""ms;
Expand Down Expand Up @@ -381,7 +382,7 @@ TEST(TestEmbeddedScheduler, EventLoopDefer_long_running_callback)
std::make_tuple("b", 20ms, 100ms)));
}

TEST(TestEmbeddedScheduler, HandleMovement)
TEST(TestOlgScheduler, HandleMovement)
{
using std::chrono_literals::operator""ms;

Expand Down Expand Up @@ -423,7 +424,7 @@ TEST(TestEmbeddedScheduler, HandleMovement)
EXPECT_THAT(evl.getTree().size(), 0);
}

} // namespace embedded_scheduler::verification
} // namespace olg_scheduler::verification

// NOLINTEND(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers)
// NOLINTEND(readability-function-cognitive-complexity, misc-const-correctness)
Expand Down