Skip to content

Commit 54ff1fa

Browse files
authored
Merge branch 'AlgorithmsDafeMipt2024:main' into homework_1
2 parents ccf0e42 + b457bd0 commit 54ff1fa

File tree

5 files changed

+58
-1
lines changed

5 files changed

+58
-1
lines changed

.github/workflows/tests.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ jobs:
5656

5757
- name: Test task 08
5858
working-directory: ${{github.workspace}}/build
59-
run: ./task_08/task_08_tests
59+
run: ./task_08/task_08_tests
60+
61+
- name: Test task 09
62+
working-directory: ${{github.workspace}}/build
63+
run: ./task_09/task_09_tests

task_09/CMakeLists.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
4+
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
5+
project(${PROJECT_NAME} C CXX)
6+
7+
set(CMAKE_CXX_STANDARD 20)
8+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
9+
10+
file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
11+
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
12+
file(GLOB_RECURSE main_source_list "src/main.cpp")
13+
file(GLOB_RECURSE test_source_list "src/*.cpp")
14+
file(GLOB_RECURSE test_list "src/*test.cpp")
15+
16+
list(REMOVE_ITEM test_source_list ${main_source_list})
17+
list(REMOVE_ITEM source_list ${test_list})
18+
19+
include_directories(${PROJECT_NAME} PUBLIC src)
20+
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)
21+
22+
add_executable(${PROJECT_NAME} ${source_list})
23+
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)
24+
25+
# Locate GTest
26+
enable_testing()
27+
find_package(GTest REQUIRED)
28+
include_directories(${GTEST_INCLUDE_DIRS})
29+
30+
# Link runTests with what we want to test and the GTest and pthread library
31+
add_executable(${PROJECT_NAME}_tests ${test_source_list})
32+
target_link_libraries(
33+
${PROJECT_NAME}_tests
34+
GTest::gtest_main
35+
Utils
36+
)
37+
38+
include(GoogleTest)
39+
gtest_discover_tests(${PROJECT_NAME}_tests)

task_09/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Задача о размене монет
2+
3+
Данно число и вектор с номиналами монет, нужно вернуть минимальное количество монет которое можно набрать данными номиналами.
4+
5+
Примеры:
6+
1) Данно число 14, и номиналы [1, 2, 5, 10], мы должны вернуть число 3 (10 * 1 + 2 * 2)
7+
2) Данно число 19, и номиналы [1, 2, 5, 10], мы должны вернуть число 4 (10 * 1 + 5 * 1 + 2 * 2)

task_09/src/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include <iostream>
2+
3+
int main() { return 0; }

task_09/src/test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
#include <gtest/gtest.h>
3+
4+
TEST(TopologySort, Simple) { ASSERT_EQ(1, 1); }

0 commit comments

Comments
 (0)