Skip to content
Commits on Source (12)
......@@ -2,11 +2,13 @@ stages:
- problem2
- problem3
- problem4
- extra
include:
- local: 'ci_cd/problem2.yml' # hw3, problem 1
- local: 'ci_cd/problem3.yml' # hw3, problem 2
- local: 'ci_cd/problem4.yml' # hw3, problem 2
- local: 'ci_cd/problem3.yml' # hw3, problem 3
- local: 'ci_cd/problem4.yml' # hw3, problem 4
- local: 'ci_cd/extra.yml' # hw3, extra credit
default:
timeout: 5m
prebuild_extra:
stage: extra
script:
- |
# Check if extra.cpp exists
if [ ! -f "extra.cpp" ]; then
echo "extra.cpp does not exist";
exit 1;
fi
rules:
- if: '$CI_COMMIT_REF_NAME == "extra"'
tags: [shell]
prebuild_extra_SKIP:
stage: extra
script:
- echo "SKIPPING extra credit checks because the branch name is not 'extra'"
rules:
- if: '$CI_COMMIT_REF_NAME != "extra"'
tags: [shell]
compile_extra:
stage: extra
script:
- echo "Compiling extra.cpp"
- git clone https://agile.bu.edu/gitlab/configs/ec327/hw-configs/hw3.git base_extra
- cp extra.cpp base_extra/tests
- cd base_extra/tests
- g++ -c extra.cpp
rules:
- if: '$CI_COMMIT_REF_NAME == "extra"'
tags: [c++-17]
lint_extra:
stage: extra
script:
- echo "Static code check of extra.cpp"
- cppcheck --check-config --enable=all --inconclusive --error-exitcode=1 extra.cpp
allow_failure: false
rules:
- if: '$CI_COMMIT_REF_NAME == "extra"'
tags: [cppcheck]
test_extra:
stage: extra
script:
- echo "Testing Extra Credit"
- git clone https://trachten-gitlab:${INTERNAL_HW_TESTS}@agile.bu.edu/gitlab/ec327/ec327-staff/hws/hw3-staff.git base_extra
- cp extra.cpp base_extra/tests
- cd base_extra/tests
- make extra
- ./extra $GITLAB_USER_LOGIN
rules:
- if: '$CI_COMMIT_REF_NAME == "extra"'
tags: [c++-17]
timeout: 15m
......@@ -23,9 +23,9 @@ compile_problem_4:
stage: problem4
script:
- echo "Compiling problem4.cpp"
- git clone https://agile.bu.edu/gitlab/configs/ec327/hw-configs/hw3.git base_3
- cp problem4.cpp base_3/tests
- cd base_3/tests
- git clone https://agile.bu.edu/gitlab/configs/ec327/hw-configs/hw3.git base_4
- cp problem4.cpp base_4/tests
- cd base_4/tests
- make problem4
rules:
- if: '$CI_COMMIT_REF_NAME == "problem4"'
......@@ -45,9 +45,9 @@ test_problem_4:
stage: problem4
script:
- echo "Testing problem 4";
- git clone https://agile.bu.edu/gitlab/configs/ec327/hw-configs/hw3.git base_3
- cp problem4.cpp base_3/tests
- cd base_3/tests
- git clone https://agile.bu.edu/gitlab/configs/ec327/hw-configs/hw3.git base_4
- cp problem4.cpp base_4/tests
- cd base_4/tests
- make problem4
- ./problem4
rules:
......
......@@ -13,7 +13,7 @@ SRCS = $(PROBLEM2_SRCS) $(PROBLEM3_SRCS) $(PROBLEM4_SRCS)
# Object files
PROBLEM2_OBJS = testProblem2.o problem2.o
PROBLEM3_OBJS = testProblem3.o problem3.o
PROBLEM4_OBJS = testProblem4.o problem4.o
PROBLEM4_OBJS = testProblem4.o problem4.o ttt_interface/ttt.o ttt_interface/HttpConnect.o
OBJS = $(PROBLEM2_OBJS) $(PROBLEM3_OBJS) $(PROBLEM4_OBJS)
# Executable names
......
......@@ -11,14 +11,17 @@ int longestStreak(string gameBoard);
bool test_2a() {
string boardA = "x--------\n-x-------\n--x------\n";
if (longestStreak(boardA)!=3)
return false;
string boardAp = "x--------\\n-x-------\\n--x------\\n";
if (longestStreak(boardA)!=3 && longestStreak(boardAp)!=3)
return false;
return true;
}
bool test_2b() {
string boardB = "xxxx----x\n-yyyyy--y\n";
if (longestStreak(boardB)!=5)
string boardBp = "xxxx----x\\n-yyyyy--y\\n";
if (longestStreak(boardB)!=5 && longestStreak(boardBp)!=5)
return false;
return true;
}
......