This repository was archived by the owner on Apr 14, 2020. It is now read-only.
forked from coders-school/meetup_modern_cpp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck.sh
More file actions
executable file
·48 lines (41 loc) · 1.28 KB
/
check.sh
File metadata and controls
executable file
·48 lines (41 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
RED="\e[41m"
GREEN="\e[42m"
BOLD="\e[1m"
DEFAULT="\e[0m"
FILE=shapes.cpp
function check()
{
if [ "$1" != 0 ] ; then
echo -e $RED "Failed on" "$@" $DEFAULT
exit 1
fi
}
function module()
{
echo -e $BOLD "$1" $DEFAULT
egrep "$2" "$FILE"
check $? $1
}
function compile()
{
echo -e $BOLD "Compiling code with C++14" $DEFAULT
make compile
check $? "compilation"
echo -e $GREEN "Compilation passed" $DEFAULT
}
compile
echo -e $BOLD "Performing mandatory checks" $DEFAULT
module "nullptr" "nullptr"
module "using alias for Collection" "using\s+Collection\s*=\s*(std::)?vector.*"
module "auto" "auto"
module "range based for loop" "auto.*\:"
module "defaulted Rectangle copy constructor" "(Rectangle)\((const)?\s*\1\s*(const)?\s*\&.*\)\s*=\s*default"
module "defaulted Square copy constructor" "(Square)\((const)?\s*\1\s*(const)?\s*\&.*\)\s*=\s*default"
module "deleted getY()" "double getY\(\)\s*=\s*delete"
module "deleted Rectangle()" "Rectangle\(\)\s*=\s*delete"
module "deleted Square()" "Square\(\)\s*=\s*delete"
module "final Square" "(class|struct)\s+Square\s+final\s*:\s*"
module "final getX()" "virtual\s+double\s+getX\(\)\s*const\s+final"
module "override" "\(\)\s*const\s+override"
echo -e $GREEN "All mandatory checks passed" $DEFAULT