Skip to content

Commit

Permalink
Merge pull request #26 from codefreak/feature/cpp-improve
Browse files Browse the repository at this point in the history
Improve C++ template
  • Loading branch information
HenningCash authored Feb 25, 2021
2 parents de897ce + 6991fe7 commit 546e545
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
7 changes: 7 additions & 0 deletions templates/cpp/.codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins:
cppcheck:
enabled: true
cpplint:
enabled: true
config:
filter: "-,+whitespace,+readability,-whitespace/ending_newline,-readability/multiline_string,-readability/casting"
3 changes: 3 additions & 0 deletions templates/cpp/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": true
}
5 changes: 4 additions & 1 deletion templates/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ set(CMAKE_CXX_STANDARD 11)
include_directories(src)

add_subdirectory(src)
add_subdirectory(test)

if(DEFINED ENV{CI})
add_subdirectory(test)
endif()
8 changes: 5 additions & 3 deletions templates/cpp/codefreak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ title: Program in C++
description: "# C++ Task Example\n\nThis is a basic C++ task to get you started quickly with Code FREAK.\n\nTo turn this into a useful programming exercise, you have to do the following.\n\n## Provide Code to Students\n\nIf you do not want your students to start completely from scratch, provide some scaffolding code. Look into `src` for some inspiration.\n\n## Setup Automatic Evaluation\n\nThis example comes with a pre-configured evaluation step. You can see it in the _Evaluation_ tab. To try it out, enter _testing mode_ and start the evaluation.\n\n### Unit Tests\n\nUnit tests are your main instrument for automatically validating your students' answers. To get started, look into `test` for example test cases.\n\nThe standard testing framework for C++ is googletest. Refer to the [official documentation](https://github.com/google/googletest) for more information.\n\n## Provide Instructions\n\nClick on this text to edit it. Here you describe to your students what they have to do.\n"
hidden:
- test/**
- .codeclimate.yml
protected:
- CMakeLists.txt
protected: []
evaluation:
- step: comments
options: {}
Expand All @@ -19,5 +20,6 @@ evaluation:
- make -C build ExampleProject_tst
- build/test/ExampleProject_tst --gtest_output=xml:test-results/TEST-report.xml
title: Unit Tests
ide:
enabled: true
- step: codeclimate
options: {}
title: Code Quality
2 changes: 1 addition & 1 deletion templates/cpp/test/CalculatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TEST_F(CalculatorTest, AdditionWithRegularNumbers) {
TEST_F(CalculatorTest, ValidAdditionsWithExtremeValues) {
EXPECT_EQ(calculator->add(INT_MAX, 0), INT_MAX);
EXPECT_EQ(calculator->add(INT_MIN, 0), INT_MIN);
EXPECT_EQ(calculator->add(INT_MAX, -1 * INT_MIN), 0);
EXPECT_EQ(calculator->add(INT_MAX, INT_MIN + 1), 0);
}

TEST_F(CalculatorTest, InvalidAdditionsThatWouldResultInAnIntegerOverflow) {
Expand Down

0 comments on commit 546e545

Please sign in to comment.