Skip to content

Commit

Permalink
Merge pull request AlgorithmsDafeMipt2024#13 from LostPointer/feature…
Browse files Browse the repository at this point in the history
…/add_tests_to_gh

add tests to gh actions
  • Loading branch information
LostPointer authored Mar 16, 2024
2 parents b87c8fd + 954bae8 commit e7f9663
Show file tree
Hide file tree
Showing 21 changed files with 288 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,32 @@ jobs:

- name: Test task 01
working-directory: ${{github.workspace}}/build
run: ./task_01/task_01_tests
run: ./task_01/task_01_tests

- name: Test task 02
working-directory: ${{github.workspace}}/build
run: ./task_02/task_02_tests

- name: Test task 03
working-directory: ${{github.workspace}}/build
run: ./task_03/task_03_tests

- name: Test task 04
working-directory: ${{github.workspace}}/build
run: ./task_04/task_04_tests

- name: Test task 05
working-directory: ${{github.workspace}}/build
run: ./task_05/task_05_tests

- name: Test task 06
working-directory: ${{github.workspace}}/build
run: ./task_06/task_06_tests

- name: Test task 07
working-directory: ${{github.workspace}}/build
run: ./task_07/task_07_tests

- name: Test task 08
working-directory: ${{github.workspace}}/build
run: ./task_08/task_08_tests
39 changes: 39 additions & 0 deletions task_04/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
3 changes: 3 additions & 0 deletions task_04/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Задача на кучу

В данной задаче необходимо реализовать [кучу](https://ru.wikipedia.org/wiki/%D0%94%D0%B2%D0%BE%D0%B8%D1%87%D0%BD%D0%B0%D1%8F_%D0%BA%D1%83%D1%87%D0%B0), можно пользоваться std::vector
3 changes: 3 additions & 0 deletions task_04/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_04/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}
39 changes: 39 additions & 0 deletions task_05/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
7 changes: 7 additions & 0 deletions task_05/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Задача на сортировку

В данной задаче необходимо реализовать сортировку одним из эфективных алгоритмов

* Merge sort
* Quick sort
* Heap sort
3 changes: 3 additions & 0 deletions task_05/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_05/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}
39 changes: 39 additions & 0 deletions task_06/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
3 changes: 3 additions & 0 deletions task_06/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Задача на порядковые статистики

В данной задаче необходимо реализовать поиск n-ой порядковой статистики
3 changes: 3 additions & 0 deletions task_06/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_06/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}
39 changes: 39 additions & 0 deletions task_07/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
3 changes: 3 additions & 0 deletions task_07/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Задача на дерево поиска

В данной задаче необходимо реализовать дерево поиска
3 changes: 3 additions & 0 deletions task_07/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_07/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}
39 changes: 39 additions & 0 deletions task_08/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
3 changes: 3 additions & 0 deletions task_08/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Задача на хэш таблицу

В данной задаче необходимо реализовать хэш таблицу
3 changes: 3 additions & 0 deletions task_08/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_08/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}

0 comments on commit e7f9663

Please sign in to comment.