Skip to content

Commit

Permalink
(Добавлены) тесты для первой таски и небольшой doc
Browse files Browse the repository at this point in the history
  • Loading branch information
vanya-beat committed Sep 27, 2024
1 parent 950cb95 commit 7a64755
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
6 changes: 6 additions & 0 deletions docker/run_tasks/run_style_check.sh
Original file line number Diff line number Diff line change
@@ -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 .
8 changes: 8 additions & 0 deletions docs/ide.md
Original file line number Diff line number Diff line change
@@ -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)
Binary file added docs/toolchains.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/toolchains2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

add_subdirectory(task_basic_c)
28 changes: 17 additions & 11 deletions tasks/task_basic_c/task_str2int/str2int_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"), "");
}

0 comments on commit 7a64755

Please sign in to comment.