Skip to content

Commit abff176

Browse files
Initialize badges
0 parents  commit abff176

27 files changed

+831
-0
lines changed

.clang-format

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
BasedOnStyle: Google
2+
Language: Cpp
3+
Standard: c++17
4+
AccessModifierOffset: -1
5+
AlignOperands: Align
6+
AlignAfterOpenBracket: Align
7+
AlignConsecutiveAssignments: None
8+
BreakBeforeBinaryOperators: NonAssignment
9+
AllowAllArgumentsOnNextLine: false
10+
AllowAllConstructorInitializersOnNextLine: false
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: Always
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Empty
15+
AllowShortIfStatementsOnASingleLine: Never
16+
AllowShortLambdasOnASingleLine: All
17+
AllowShortLoopsOnASingleLine: false
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakTemplateDeclarations: Yes
20+
AlwaysBreakBeforeMultilineStrings: false
21+
BreakBeforeBraces: Custom
22+
BraceWrapping:
23+
AfterCaseLabel: false
24+
AfterClass: false
25+
AfterControlStatement: Never
26+
AfterEnum: false
27+
AfterFunction: false
28+
AfterNamespace: false
29+
AfterUnion: false
30+
BeforeCatch: false
31+
BeforeElse: false
32+
IndentBraces: false
33+
SplitEmptyFunction: false
34+
SplitEmptyRecord: true
35+
BreakBeforeTernaryOperators: false
36+
BreakConstructorInitializers: BeforeColon
37+
BreakInheritanceList: BeforeColon
38+
BinPackParameters: true
39+
ColumnLimit: 120
40+
CompactNamespaces: false
41+
ContinuationIndentWidth: 4
42+
IndentCaseLabels: true
43+
IndentPPDirectives: BeforeHash
44+
IndentWidth: 2
45+
KeepEmptyLinesAtTheStartOfBlocks: true
46+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
47+
MaxEmptyLinesToKeep: 1
48+
SortIncludes: Never
49+
NamespaceIndentation: All
50+
ObjCSpaceAfterProperty: false
51+
ObjCSpaceBeforeProtocolList: false
52+
PointerAlignment: Right
53+
ReflowComments: false
54+
SpaceAfterCStyleCast: true
55+
SpaceAfterLogicalNot: false
56+
SpaceAfterTemplateKeyword: false
57+
SpaceBeforeAssignmentOperators: true
58+
SpaceBeforeCpp11BracedList: false
59+
SpaceBeforeCtorInitializerColon: true
60+
SpaceBeforeInheritanceColon: true
61+
SpaceBeforeParens: ControlStatements
62+
SpaceBeforeRangeBasedForLoopColon: true
63+
SpaceInEmptyParentheses: false
64+
SpacesBeforeTrailingComments: 2
65+
SpacesInAngles: false
66+
SpacesInCStyleCastParentheses: false
67+
SpacesInContainerLiterals: false
68+
SpacesInParentheses: false
69+
SpacesInSquareBrackets: false
70+
TabWidth: 4
71+
UseTab: Never
72+
AlignTrailingComments: true
73+
FixNamespaceComments: true

.clang-tidy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
Checks: 'clang-analyzer-*,misc-*,google-*,performance-*,readability-*'
3+
WarningsAsErrors: '*'
4+
HeaderFilterRegex: ''
5+
FormatStyle: none

.github/badges/points-bar.svg

Lines changed: 24 additions & 0 deletions
Loading

.github/classroom/autograding.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"tests": [
3+
{
4+
"name": "This is an empty test-case!",
5+
"setup": "echo \"Configuring... Wait a minute...\"",
6+
"run": "echo \"Success! You got 1 point!\"",
7+
"input": "",
8+
"output": "",
9+
"comparison": "exact",
10+
"timeout": 1,
11+
"points": 1
12+
},
13+
{
14+
"name": "Passing test-case",
15+
"setup": "",
16+
"run": "ctest -VVV --output-on-failure --test-dir build -R \"Passing test-case\"",
17+
"input": "",
18+
"output": "",
19+
"comparison": "exact",
20+
"timeout": 1,
21+
"points": 1
22+
},
23+
{
24+
"name": "Failing test-case",
25+
"setup": "",
26+
"run": "ctest -VVV --output-on-failure --test-dir build -R \"Failing test-case\"",
27+
"input": "",
28+
"output": "",
29+
"comparison": "exact",
30+
"timeout": 1,
31+
"points": 1
32+
}
33+
]
34+
}

.github/workflows/classroom.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# For details refer https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions.
2+
name: GitHub Classroom
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches: [ 'master', 'main' ]
8+
paths: [ 'src/**', 'include/**' ]
9+
10+
env:
11+
# CMake build type: Release, Debug, RelWithDebInfo, etc.
12+
BUILD_TYPE: Release
13+
14+
defaults:
15+
run: { shell: bash }
16+
17+
jobs:
18+
autograding:
19+
name: Autograding
20+
runs-on: ubuntu-20.04
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
with: { submodules: 'recursive', fetch-depth: 0 }
25+
26+
- name: Create Build Environment
27+
run: cmake -E make_directory ${{github.workspace}}/build
28+
29+
- name: Configure CMake
30+
working-directory: ${{github.workspace}}/build
31+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
32+
33+
- name: CMake Build
34+
working-directory: ${{github.workspace}}/build
35+
run: cmake --build . --config $BUILD_TYPE
36+
37+
- name: GitHub Autograding
38+
uses: education/autograding@v1
39+
continue-on-error: true
40+
id: autograder
41+
42+
# Add the badge with the current student's score.
43+
- name: Checkout badges branch
44+
run: git checkout badges || git checkout -b badges
45+
46+
- name: Generate badge with a score
47+
uses: markpatterson27/points-bar@v1
48+
with:
49+
points: ${{ steps.autograder.outputs.points }}
50+
path: '.github/badges/points-bar.svg'
51+
label: 'Score'
52+
type: badge
53+
54+
- name: Update badge with a score
55+
run: |
56+
git config --local user.email "action@github.com"
57+
git config --local user.name "GitHub Action"
58+
git add '.github/badges/points-bar.svg'
59+
git commit -m "Add/Update points bar" || exit 0
60+
git push origin badges

.github/workflows/memcheck.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Check Memory Leaks
2+
3+
on: [ workflow_dispatch ]
4+
5+
defaults:
6+
run: { shell: bash }
7+
8+
env:
9+
# Memory check requires Debug builds.
10+
BUILD_TYPE: Debug
11+
12+
jobs:
13+
memcheck:
14+
name: Check Memory Leakage
15+
runs-on: ubuntu-20.04
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
with: { submodules: 'recursive' }
20+
21+
- name: Install valgrind
22+
run: sudo apt-get -qq update && sudo apt-get install -qq valgrind
23+
24+
- name: Create Build Environment
25+
run: cmake -E make_directory ${{github.workspace}}/build
26+
27+
- name: Configure CMake
28+
working-directory: ${{github.workspace}}/build
29+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_MEMCHECK=ON
30+
31+
- name: CMake Build
32+
working-directory: ${{github.workspace}}/build
33+
run: cmake --build . --config $BUILD_TYPE
34+
35+
# See more https://cmake.org/cmake/help/latest/manual/ctest.1.html.
36+
- name: Run CTest with MemCheck
37+
working-directory: ${{github.workspace}}/build
38+
run: >
39+
ctest -VVV -C $BUILD_TYPE -D ExperimentalMemCheck --output-on-failure
40+
--overwrite MemoryCheckCommandOptions="--tool=memcheck --leak-check=full --error-exitcode=100"

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# build files
2+
cmake-build*
3+
build*
4+
5+
# IDE files
6+
.idea
7+
8+
# Executables
9+
*.exe
10+
11+
# Compiled Dynamic librarires
12+
*.so
13+
*.dll
14+
15+
# Solutions
16+
src/solution

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "contrib/Catch2"]
2+
path = contrib/Catch2
3+
url = https://github.com/catchorg/Catch2.git

CMakeLists.txt

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This is the top-level CMakeLists.txt file
2+
3+
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
4+
5+
project(cpp_assignment CXX)
6+
7+
# C++ standard specification
8+
set(CMAKE_CXX_STANDARD 17)
9+
set(CMAKE_CXX_EXTENSIONS ON)
10+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
11+
12+
# Helpers
13+
include(CMakePrintHelpers)
14+
include(cmake/MemCheck.cmake)
15+
include(cmake/CompilerWarnings.cmake)
16+
17+
# Options
18+
option(BUILD_TESTS "Build assignment tests." ON)
19+
option(ENABLE_COMPILER_WARNINGS "Project compile warnings." ON)
20+
option(ENABLE_MEMCHECK "Configure project for memory checking." OFF)
21+
22+
cmake_print_variables(CMAKE_BUILD_TYPE BUILD_TESTS ENABLE_COMPILER_WARNINGS ENABLE_MEMCHECK)
23+
24+
# Library
25+
add_library(${PROJECT_NAME} STATIC)
26+
27+
if (EXISTS ${PROJECT_SOURCE_DIR}/src/solution)
28+
message(STATUS "Using solution code: yes")
29+
30+
file(GLOB CPP_SOURCES RELATIVE ${PROJECT_SOURCE_DIR} src/solution/*.cpp)
31+
target_sources(${PROJECT_NAME} PRIVATE ${CPP_SOURCES})
32+
else ()
33+
message(STATUS "Using solution code: no")
34+
35+
file(GLOB CPP_SOURCES RELATIVE ${PROJECT_SOURCE_DIR} src/*.cpp)
36+
target_sources(${PROJECT_NAME} PRIVATE ${CPP_SOURCES})
37+
endif ()
38+
39+
target_include_directories(${PROJECT_NAME} PUBLIC include)
40+
41+
# Executables
42+
add_executable(run_${PROJECT_NAME} main.cpp)
43+
target_link_libraries(run_${PROJECT_NAME} PRIVATE ${PROJECT_NAME})
44+
45+
# Warnings
46+
if (ENABLE_COMPILER_WARNINGS)
47+
message(STATUS "Compiler warnings: enabled")
48+
49+
add_library(project_warnings INTERFACE)
50+
set_project_warnings(project_warnings)
51+
52+
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings)
53+
target_link_libraries(run_${PROJECT_NAME} PRIVATE project_warnings)
54+
endif (ENABLE_COMPILER_WARNINGS)
55+
56+
# Memory Check
57+
if (ENABLE_MEMCHECK)
58+
enable_memcheck()
59+
endif (ENABLE_MEMCHECK)
60+
61+
# Tests
62+
if (BUILD_TESTS)
63+
enable_testing()
64+
add_subdirectory(contrib)
65+
add_subdirectory(tests)
66+
endif (BUILD_TESTS)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Intelligent Robotics Dept.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)