-
Notifications
You must be signed in to change notification settings - Fork 0
Hw 1 #1
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
Open
BorisKoz
wants to merge
60
commits into
master
Choose a base branch
from
HW-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Hw 1 #1
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
4efb806
fill repo correctly
BorisKoz 51c488c
ver.2
BorisKoz 16088c6
added simple gtest. plan on adding more. switching to travis
BorisKoz d38a676
create a correct travis iml
BorisKoz bbc719c
Update .travis.yml
BorisKoz 80ac820
Update README.md
BorisKoz 5b79a2f
Update .travis.yml
BorisKoz 2336041
cmake v lower
BorisKoz 2d62b83
Update .travis.yml
BorisKoz f323962
Merge branch 'HW-1' of https://github.com/BorisKoz/cpp_2021 into HW-1
BorisKoz d74186f
Update README.md
BorisKoz 678ab3b
Update .travis.yml
BorisKoz 7c26f21
Update .travis.yml
BorisKoz 209750d
Update .travis.yml
BorisKoz 7147352
Update README.md
BorisKoz 2e7c0f2
Update .travis.yml
BorisKoz 65654fd
resolving the segfault
BorisKoz c7bf8c5
Merge branch 'HW-1' of https://github.com/BorisKoz/cpp_2021 into HW-1
BorisKoz 97cf7de
fixed stupid mistake of wrong names
BorisKoz 759d538
Update .travis.yml
BorisKoz 3d01538
fixed mleaks
BorisKoz 130b07b
Merge branch 'HW-1' of https://github.com/BorisKoz/cpp_2021 into HW-1
BorisKoz 3ce1058
Update .travis.yml
BorisKoz 1262ffd
Update .travis.yml
BorisKoz 0106eb1
Update .travis.yml
BorisKoz 537e61e
added flags for codecov
BorisKoz d9f08b2
Update .travis.yml
BorisKoz 472b346
Update README.md
BorisKoz 7bc2cde
changed test names & structure
BorisKoz be813e8
added 97% codecov
BorisKoz 57ede38
corrected tests execute dir
BorisKoz 5e88e41
corrected cpplint
BorisKoz add27d5
added tests cpplint
BorisKoz 8ea7abb
added terminal input. running tests on valgrind on remote to check ir
BorisKoz aacd6df
valgrind test look src
BorisKoz b4eabcb
valgrind test 2 look src
BorisKoz 84b0212
seems like no leaks
BorisKoz 54caede
next try
BorisKoz cfffa66
fixed cpplint
BorisKoz 72828b7
search is now in another func, with gtest. added cppcheck tags
BorisKoz 2a8e204
static complete
BorisKoz bd2c90b
valgrind is fun
BorisKoz 2fb0d49
Update .travis.yml
BorisKoz 381fbc5
valgrind is so FUN
BorisKoz 39e8f28
Merge branch 'HW-1' of https://github.com/BorisKoz/cpp_2021 into HW-1
BorisKoz 3f4db2a
found uninitialised float
BorisKoz fa5ee89
found uninitialised float
BorisKoz 4bf2d11
vagrind for the win
BorisKoz 6ec3e6d
fixed travis
BorisKoz 46109a8
fixed travis again
BorisKoz 3673d77
until I understand how to < with valgr in is 255, so removed
BorisKoz da8519b
255 was because of code error, lol. remade
BorisKoz 474e7e9
fixed almost all. to travis
BorisKoz aee11c9
fixed minor leak error
BorisKoz ce3ace4
added all to one Cmake
BorisKoz 2796675
error in Cmake fixed
BorisKoz d7d9f88
fixed vg, added logic to diff header
BorisKoz 64d6400
fixed travis misspell and cpplint
BorisKoz bcb8566
fixed newline
BorisKoz f90f31c
fix to new reviews
BorisKoz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or 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,5 @@ | ||
| coverage: | ||
| status: | ||
| patch: | ||
| default: | ||
| target:80% |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,11 +1,9 @@ | ||
|
|
||
| # CMake | ||
| project/build/ | ||
| CMakeFiles/ | ||
| CMakeCache.txt | ||
| cmake-build-debug/ | ||
| cmake-build-debug-coverage/ | ||
| *.cmake | ||
|
|
||
|
|
||
| .idea/ | ||
| .DS_Store | ||
|
|
This file contains hidden or 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,29 @@ | ||
| dist: focal | ||
|
|
||
| language: c | ||
|
|
||
| os: linux | ||
|
|
||
| compiler: gcc | ||
|
|
||
| install: | ||
| - sudo apt-get install valgrind | ||
| - sudo apt-get install clang | ||
| - sudo apt-get install cppcheck | ||
| - sudo pip install cpplint | ||
|
|
||
| script: | ||
| - cd project/ | ||
| - mkdir build | ||
| - cd build | ||
| - cmake .. | ||
| - make clean && make | ||
| - cppcheck --inconclusive --enable=all --language=c ../include/*.h ../src/*.c | ||
| - cpplint ../include/*.h ../src/*.c ../tests/*.cpp | ||
| - valgrind --leak-check=full --track-origins=yes ./main.out ../db.txt ../find.txt < ../find.txt | ||
| - valgrind --leak-check=full --track-origins=yes ./cars_tests | ||
|
|
||
|
|
||
|
|
||
| after_success: | ||
| - bash <(curl -s https://codecov.io/bash) |
This file contains hidden or 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,4 @@ | ||
| filter=-legal/copyright | ||
| filter=-build/include_subdir | ||
| filter=-build/include | ||
| filter=-readability/casting |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,20 @@ | ||
| # cpp_2021 | ||
|
|
||
|
|
||
| [](https://travis-ci.com/BorisKoz/cpp_2021) | ||
|
|
||
| [](https://codecov.io/gh/BorisKoz/cpp_2021) | ||
|
|
||
|
|
||
| # Вариант #4 | ||
| Создать структуру для хранения характеристик автомобилей: мощности двигателя, скорости, расхода топлива, формы кузова и модели. Составить с ее использованием программу поиска модели автомобиля, характеристики которой наиболее удовлетворяют запросу. | ||
|
|
||
| # Требования к оформлению: | ||
| Программа должна быть реализована на языке C и работать для произвольных наборов входных данных (в том числе и ошибочных), вводимых пользователем с клавиатуры. Должна быть выполнена грамотная декомпозиция на функции и файлы. | ||
| Помимо самой программы необходимо: | ||
| – разработать набор юнит-тестов, проверяющих корректную работу реализованных функций. Обеспечить максимальное покрытие исходного кода тестами; | ||
| – оформить задачу в виде Merge Request отдельной ветки в основную ветку проекта. | ||
| Внимание: в основной ветке проекта никакого кода быть не должно! | ||
| – развернуть CI, в рамках которого автоматизировать сборку проекта, прохождение юнит-тестов под valgrind, генерацию отчёта о покрытии кода тестами, линтера и статического анализатора исходного кода; | ||
| – после прохождения всех проверок необходимо отправить код на ревью своему преподавателю; | ||
| – ревью - процесс итерационный. До наступления дедлайна можно проходить несколько итераций, улучшая свою оценку. Решения после дедлайна не принимаются; |
Binary file not shown.
This file contains hidden or 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,45 @@ | ||
| cmake_minimum_required(VERSION 3.15) | ||
| project(cars) | ||
|
|
||
| configure_file(CMakeLists.txt.in | ||
| googletest-download/CMakeLists.txt) | ||
| execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . | ||
| WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) | ||
| execute_process(COMMAND ${CMAKE_COMMAND} --build . | ||
| WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) | ||
|
|
||
| add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src | ||
| ${CMAKE_BINARY_DIR}/googletest-build) | ||
|
|
||
| set(CMAKE_C_FLAGS "-pedantic -fprofile-arcs -ftest-coverage") | ||
| set(CMAKE_CXX_FLAGS "-pedantic -fprofile-arcs -ftest-coverage") | ||
|
|
||
| enable_testing() | ||
|
|
||
|
|
||
| include_directories("${PROJECT_SOURCE_DIR}/include") | ||
|
|
||
|
|
||
| file(GLOB prod_sources | ||
| "${PROJECT_SOURCE_DIR}/include/*.h" | ||
| "${PROJECT_SOURCE_DIR}/src/cars.c" | ||
| "${PROJECT_SOURCE_DIR}/src/main.c") | ||
|
|
||
| add_executable(main.out ${prod_sources}) | ||
|
|
||
| file(GLOB test_sources "${PROJECT_SOURCE_DIR}/src/*.c") | ||
| list(REMOVE_ITEM test_sources "${PROJECT_SOURCE_DIR}/src/main.c") | ||
|
|
||
| file(GLOB tests "${PROJECT_SOURCE_DIR}/tests/*.cpp") | ||
| list(REMOVE_ITEM tests "${PROJECT_SOURCE_DIR}/tests/main.cpp") | ||
|
|
||
| foreach(file ${tests}) | ||
| set(name) | ||
| get_filename_component(name ${file} NAME_WE) | ||
| add_executable("${name}_tests" | ||
| ${test_sources} | ||
| ${file} | ||
| "${PROJECT_SOURCE_DIR}/tests/main.cpp") | ||
| target_link_libraries("${name}_tests" gtest_main) | ||
| add_test(NAME ${name} COMMAND "${name}_tests") | ||
| endforeach() | ||
This file contains hidden or 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,15 @@ | ||
| cmake_minimum_required(VERSION 3.15) | ||
|
|
||
| project(googletest-download NONE) | ||
|
|
||
| include(ExternalProject) | ||
| ExternalProject_Add(googletest | ||
| GIT_REPOSITORY https://github.com/google/googletest.git | ||
| GIT_TAG release-1.8.1 | ||
| SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src" | ||
| BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build" | ||
| CONFIGURE_COMMAND "" | ||
| BUILD_COMMAND "" | ||
| INSTALL_COMMAND "" | ||
| TEST_COMMAND "" | ||
| ) |
This file contains hidden or 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,227 @@ | ||
| # CMAKE generated file: DO NOT EDIT! | ||
| # Generated by "Unix Makefiles" Generator, CMake Version 3.19 | ||
|
|
||
| # Default target executed when no arguments are given to make. | ||
| default_target: all | ||
|
|
||
| .PHONY : default_target | ||
|
|
||
| # Allow only one "make -f Makefile2" at a time, but pass parallelism. | ||
| .NOTPARALLEL: | ||
|
|
||
|
|
||
| #============================================================================= | ||
| # Special targets provided by cmake. | ||
|
|
||
| # Disable implicit rules so canonical targets will work. | ||
| .SUFFIXES: | ||
|
|
||
|
|
||
| # Disable VCS-based implicit rules. | ||
| % : %,v | ||
|
|
||
|
|
||
| # Disable VCS-based implicit rules. | ||
| % : RCS/% | ||
|
|
||
|
|
||
| # Disable VCS-based implicit rules. | ||
| % : RCS/%,v | ||
|
|
||
|
|
||
| # Disable VCS-based implicit rules. | ||
| % : SCCS/s.% | ||
|
|
||
|
|
||
| # Disable VCS-based implicit rules. | ||
| % : s.% | ||
|
|
||
|
|
||
| .SUFFIXES: .hpux_make_needs_suffix_list | ||
|
|
||
|
|
||
| # Command-line flag to silence nested $(MAKE). | ||
| $(VERBOSE)MAKESILENT = -s | ||
|
|
||
| #Suppress display of executed commands. | ||
| $(VERBOSE).SILENT: | ||
|
|
||
| # A target that is always out of date. | ||
| cmake_force: | ||
|
|
||
| .PHONY : cmake_force | ||
|
|
||
| #============================================================================= | ||
| # Set environment variables for the build. | ||
|
|
||
| # The shell in which to execute make rules. | ||
| SHELL = /bin/sh | ||
|
|
||
| # The CMake executable. | ||
| CMAKE_COMMAND = /usr/local/Cellar/cmake/3.19.6/bin/cmake | ||
|
|
||
| # The command to remove a file. | ||
| RM = /usr/local/Cellar/cmake/3.19.6/bin/cmake -E rm -f | ||
|
|
||
| # Escaping for special characters. | ||
| EQUALS = = | ||
|
|
||
| # The top-level source directory on which CMake was run. | ||
| CMAKE_SOURCE_DIR = /Users/boriskozuro/Desktop/tp_c_2021/project | ||
|
|
||
| # The top-level build directory on which CMake was run. | ||
| CMAKE_BINARY_DIR = /Users/boriskozuro/Desktop/tp_c_2021/project | ||
|
|
||
| #============================================================================= | ||
| # Targets provided globally by CMake. | ||
|
|
||
| # Special rule for the target rebuild_cache | ||
| rebuild_cache: | ||
| @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." | ||
| /usr/local/Cellar/cmake/3.19.6/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) | ||
| .PHONY : rebuild_cache | ||
|
|
||
| # Special rule for the target rebuild_cache | ||
| rebuild_cache/fast: rebuild_cache | ||
|
|
||
| .PHONY : rebuild_cache/fast | ||
|
|
||
| # Special rule for the target edit_cache | ||
| edit_cache: | ||
| @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." | ||
| /usr/local/Cellar/cmake/3.19.6/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) | ||
| .PHONY : edit_cache | ||
|
|
||
| # Special rule for the target edit_cache | ||
| edit_cache/fast: edit_cache | ||
|
|
||
| .PHONY : edit_cache/fast | ||
|
|
||
| # The main all target | ||
| all: cmake_check_build_system | ||
| $(CMAKE_COMMAND) -E cmake_progress_start /Users/boriskozuro/Desktop/tp_c_2021/project/CMakeFiles /Users/boriskozuro/Desktop/tp_c_2021/project//CMakeFiles/progress.marks | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all | ||
| $(CMAKE_COMMAND) -E cmake_progress_start /Users/boriskozuro/Desktop/tp_c_2021/project/CMakeFiles 0 | ||
| .PHONY : all | ||
|
|
||
| # The main clean target | ||
| clean: | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean | ||
| .PHONY : clean | ||
|
|
||
| # The main clean target | ||
| clean/fast: clean | ||
|
|
||
| .PHONY : clean/fast | ||
|
|
||
| # Prepare targets for installation. | ||
| preinstall: all | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall | ||
| .PHONY : preinstall | ||
|
|
||
| # Prepare targets for installation. | ||
| preinstall/fast: | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall | ||
| .PHONY : preinstall/fast | ||
|
|
||
| # clear depends | ||
| depend: | ||
| $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 | ||
| .PHONY : depend | ||
|
|
||
| #============================================================================= | ||
| # Target rules for targets named test1 | ||
|
|
||
| # Build rule for target. | ||
| test1: cmake_check_build_system | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 test1 | ||
| .PHONY : test1 | ||
|
|
||
| # fast build rule for target. | ||
| test1/fast: | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/test1.dir/build.make CMakeFiles/test1.dir/build | ||
| .PHONY : test1/fast | ||
|
|
||
| src/cars.o: src/cars.c.o | ||
|
|
||
| .PHONY : src/cars.o | ||
|
|
||
| # target to build an object file | ||
| src/cars.c.o: | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/test1.dir/build.make CMakeFiles/test1.dir/src/cars.c.o | ||
| .PHONY : src/cars.c.o | ||
|
|
||
| src/cars.i: src/cars.c.i | ||
|
|
||
| .PHONY : src/cars.i | ||
|
|
||
| # target to preprocess a source file | ||
| src/cars.c.i: | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/test1.dir/build.make CMakeFiles/test1.dir/src/cars.c.i | ||
| .PHONY : src/cars.c.i | ||
|
|
||
| src/cars.s: src/cars.c.s | ||
|
|
||
| .PHONY : src/cars.s | ||
|
|
||
| # target to generate assembly for a file | ||
| src/cars.c.s: | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/test1.dir/build.make CMakeFiles/test1.dir/src/cars.c.s | ||
| .PHONY : src/cars.c.s | ||
|
|
||
| src/main.o: src/main.c.o | ||
|
|
||
| .PHONY : src/main.o | ||
|
|
||
| # target to build an object file | ||
| src/main.c.o: | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/test1.dir/build.make CMakeFiles/test1.dir/src/main.c.o | ||
| .PHONY : src/main.c.o | ||
|
|
||
| src/main.i: src/main.c.i | ||
|
|
||
| .PHONY : src/main.i | ||
|
|
||
| # target to preprocess a source file | ||
| src/main.c.i: | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/test1.dir/build.make CMakeFiles/test1.dir/src/main.c.i | ||
| .PHONY : src/main.c.i | ||
|
|
||
| src/main.s: src/main.c.s | ||
|
|
||
| .PHONY : src/main.s | ||
|
|
||
| # target to generate assembly for a file | ||
| src/main.c.s: | ||
| $(MAKE) $(MAKESILENT) -f CMakeFiles/test1.dir/build.make CMakeFiles/test1.dir/src/main.c.s | ||
| .PHONY : src/main.c.s | ||
|
|
||
| # Help Target | ||
| help: | ||
| @echo "The following are some of the valid targets for this Makefile:" | ||
| @echo "... all (the default if no target is provided)" | ||
| @echo "... clean" | ||
| @echo "... depend" | ||
| @echo "... edit_cache" | ||
| @echo "... rebuild_cache" | ||
| @echo "... test1" | ||
| @echo "... src/cars.o" | ||
| @echo "... src/cars.i" | ||
| @echo "... src/cars.s" | ||
| @echo "... src/main.o" | ||
| @echo "... src/main.i" | ||
| @echo "... src/main.s" | ||
| .PHONY : help | ||
|
|
||
|
|
||
|
|
||
| #============================================================================= | ||
| # Special targets to cleanup operation of make. | ||
|
|
||
| # Special rule to run CMake to check the build system integrity. | ||
| # No rule that depends on this can have commands that come from listfiles | ||
| # because they might be regenerated. | ||
| cmake_check_build_system: | ||
| $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 | ||
| .PHONY : cmake_check_build_system | ||
|
|
This file contains hidden or 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,4 @@ | ||
| 150 200 2 Renault_Logan Jeep | ||
| 100 100 2 Toyota_Camry Sedan | ||
| 100 100 1 Toyota_Camry Sedan | ||
| 100 120 2 Renault_Sanderas Sedan |
This file contains hidden or 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 @@ | ||
| 100 100 1 Toyota_Camry Sedan |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нет продуктовой цели, только тестовая.