diff --git a/docker/run_tasks/run_style_check.sh b/docker/run_tasks/run_style_check.sh new file mode 100644 index 0000000..9a41364 --- /dev/null +++ b/docker/run_tasks/run_style_check.sh @@ -0,0 +1,6 @@ +# get the current directory +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# go up two directories +cd $DIR/../.. + +cpplint --extensions=h,hpp,cpp,c --exclude=build --exclude=cmake-build-debug --recursive --linelength=120 --filter=-build/include_subdir,-legal/copyright --output=vs7 . diff --git a/docs/ide.md b/docs/ide.md new file mode 100644 index 0000000..41fd459 --- /dev/null +++ b/docs/ide.md @@ -0,0 +1,8 @@ +# Если у вас Clion +1. Установите самую свежую версию [CLion](https://www.jetbrains.com/ru-ru/clion/). CLion поддерживает тулчейн Docker начиная с версии 2021.3. +2. Установите [Docker](https://www.docker.com/). +3. Откройте проект в CLion. +4. Создайте docker-toolchain в CLion. +![toolchains.png](toolchains.png) +5. Если все будет хорошо Clion сама подтянет все пути +![toolchains2.png](toolchains2.png) \ No newline at end of file diff --git a/docs/toolchains.png b/docs/toolchains.png new file mode 100644 index 0000000..f8562b3 Binary files /dev/null and b/docs/toolchains.png differ diff --git a/docs/toolchains2.png b/docs/toolchains2.png new file mode 100644 index 0000000..acea680 Binary files /dev/null and b/docs/toolchains2.png differ diff --git a/tasks/CMakeLists.txt b/tasks/CMakeLists.txt index b308d86..a3ee107 100644 --- a/tasks/CMakeLists.txt +++ b/tasks/CMakeLists.txt @@ -1,2 +1 @@ - add_subdirectory(task_basic_c) diff --git a/tasks/task_basic_c/task_str2int/str2int_tests.cpp b/tasks/task_basic_c/task_str2int/str2int_tests.cpp index 1f072ab..5ec93d1 100644 --- a/tasks/task_basic_c/task_str2int/str2int_tests.cpp +++ b/tasks/task_basic_c/task_str2int/str2int_tests.cpp @@ -14,14 +14,20 @@ TEST(str2int, BasicTestZeroNext) { EXPECT_DEATH(str2int("-"), ""); } -// TEST(str2int, BasicTest1) { -// EXPECT_EQ(str2int("1"), 1); -// } -// -// TEST(str2int, BasicTestPlus1) { -// EXPECT_EQ(str2int("+1"), 1); -// } -// -// TEST(str2int, BasicTestMinus1) { -// EXPECT_EQ(str2int("-1"), -1); -// } +TEST(str2int, BasicTestEmptyString) { + EXPECT_DEATH(str2int(""), ""); +} + +TEST(str2int, BasicTestNumbers) { + EXPECT_EQ(str2int("-5"), -5); + EXPECT_EQ(str2int("-66"), -66); + EXPECT_EQ(str2int("-123"), -123); + EXPECT_EQ(str2int("2147483647"), 2147483647); + EXPECT_EQ(str2int("-2147483648"), -2147483648); +} + +TEST(str2int, BasicTestDeath) { + EXPECT_DEATH(str2int("-2147483649"), ""); + EXPECT_DEATH(str2int("2147483648"), ""); + EXPECT_DEATH(str2int("214748364999"), ""); +}