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

hw_ 1 #1

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.vscode
*.DS_Store
*.swp
*.out
Makefile
build*/
42 changes: 42 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
dist: bionic
sudo: required

language: c

os: linux

compiler: gcc

env:
global:
- CODECOV_TOKEN="83d8152e-4406-4ced-8d01-5782b464d196"

install:
- sudo apt-get update
- sudo apt-get install valgrind
- sudo apt-get install clang-format
- sudo apt-get install lcov
- sudo apt-get install libstdc++6
- sudo apt-get install cmake
- sudo apt-get install cppcheck
# Google tests
- sudo apt-get install libgtest-dev
- cd /usr/src/gtest
- sudo cmake .
- sudo make
- sudo cp *.a /usr/lib
- cd -

before_script:
- ./linters/run.sh --local || travis_terminate 1

script:
- cmake .
- make || travis_terminate 1
- valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --leak-resolution=med --track-origins=yes ./test_longest_arth_seq.out || travis_terminate 1
- valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --leak-resolution=med --track-origins=yes ./test_parse_input.out || travis_terminate 1

after_script:
- lcov —capture —directory ./CMakeFiles/task_library.dir/project/src —output-file coverage.info
- bash <(curl -s https://codecov.io/bash)
- make clean
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.11)
project(hw1)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "--coverage")
set(CMAKE_C_FLAGS "--coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror --pedantic")

include_directories(project/longest_arth_seq project/parser)

set(_LONGEST_ARTH_SEQ_SRC project/longest_arth_seq/longest_arth_seq.c)
set(_PARSE_INPUT_SRC project/parser/parse_input.c)

# sets GTEST_INCLUDE_DIRS and GTEST_LIBRARIES
find_package( GTest REQUIRED )
# adds the gtest include directory
include_directories(${GTEST_INCLUDE_DIRS})

# main project longest_arithmetic_sequence
add_executable(longest_arth_seq.out project/longest_arth_seq/main.c ${_LONGEST_ARTH_SEQ_SRC} ${_PARSE_INPUT_SRC})

# tests for longest_arth_seq.c
add_executable(test_longest_arth_seq.out project/longest_arth_seq/test_longest_arth_seq.cpp ${_LONGEST_ARTH_SEQ_SRC})

target_link_libraries(test_longest_arth_seq.out ${GTEST_LIBRARIES})
target_link_libraries(test_longest_arth_seq.out pthread)

# tests for parse_input.c
add_executable(test_parse_input.out project/parser/test_parse_input.cpp ${_PARSE_INPUT_SRC})

target_link_libraries(test_parse_input.out ${GTEST_LIBRARIES})
target_link_libraries(test_parse_input.out pthread)
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# TP-2020-Spring-C-Cpp
Technopark C/C+, Spring 2020
[![Build Status](https://travis-ci.org/AndrewShukhtin/TP-2020-Spring-C-Cpp.svg?branch=hw-1)](https://travis-ci.org/AndrewShukhtin/TP-2020-Spring-C-Cpp)
[![codecov](https://codecov.io/gh/AndrewShukhtin/TP-2020-Spring-C-Cpp/branch/hw-1/graph/badge.svg)](https://codecov.io/gh/AndrewShukhtin/TP-2020-Spring-C-Cpp)

Technopark C/C++, Spring 2020

Условие ИЗ№1:
Составить программу определения такой максимальной последовательности среди элементов заданного целочисленного массива, элементы которой являются арифметической прогрессией. Элементы последовательности функция должна вернуть через указатель-параметр, а ее длину — через возвращаемый результат.
2 changes: 2 additions & 0 deletions input_tests/corrupted_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
3
2 3 a
2 changes: 2 additions & 0 deletions input_tests/invalid_size.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-1
2 3 4
2 changes: 2 additions & 0 deletions input_tests/leet_code_ex1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
4
3 6 9 12
Loading