Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions .github/workflows/close-pr.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Close Pull Request

on:
pull_request_target:
types: [opened]

jobs:
check-and-close:
runs-on: ubuntu-latest
steps:
- name: Close Pull Request
if: ${{ github.event.repository.fork == false }}
uses: superbrothers/close-pull-request@v3
with:
comment: "This pull request has been automatically closed because it was opened in the upstream repository. Create your PRs within your own forked repository."

name: Close Pull Request
on:
pull_request_target:
types: [opened]
jobs:
check-and-close:
runs-on: ubuntu-latest
steps:
- name: Close Pull Request
if: ${{ github.event.repository.fork == false }}
uses: superbrothers/close-pull-request@v3
with:
comment: "This pull request has been automatically closed because it was opened in the upstream repository. Create your PRs within your own forked repository."
25 changes: 19 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
IndividualMiniprojectC++/.vscode/
IndividualMiniprojectC++/external_libraries/boost_1_85_0
IndividualMiniprojectC++/external_libraries/Crow-1.2.0-Darwin
IndividualMiniprojectC++/build/*
!IndividualMiniprojectC++/build/README.txt
!IndividualMiniprojectC++/external_libraries/README.txt
IndividualMiniprojectC++/.vscode/
IndividualMiniprojectC++/external_libraries/boost_1_85_0
IndividualMiniprojectC++/external_libraries/Crow-1.2.0-Darwin
IndividualMiniprojectC++/external_libraries/asio-master
IndividualMiniprojectC++/external_libraries/asio.hpp
IndividualMiniprojectC++/IndividualMiniproject.exe
IndividualMiniprojectC++/IndividualMiniprojectTests.exe
IndividualMiniprojectC++/
IndividualMiniprojectC++/build/*
!IndividualMiniprojectC++/build/README.txt
!IndividualMiniprojectC++/external_libraries/README.txt
_deps/
CMakeFiles/
lib/
cmake_install.cmake
CMakeCache.txt
CTestTestfile.cmake
IndividualMiniprojectTests[1]_include.cmake
Makefile
13 changes: 13 additions & 0 deletions Bugs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Following bugs were taken care of

Check Invalid inputs for dropStudent
Check Invalid inputs for enrollStudent
Check Invalid inputs for setEnrolledStudentCount
Syntax for getDepartmentChair function
Syntax errors for size_t datatype
enrolledStudentCount variable initialized with 0
Corrected condition check for dropStudent function
getInstructorName function's return variable changed to InstructorName
getCourseTimeslot function's return variable changed to CourseTimeslot
Corrected condition check for setEnrolledStudentCount function
Corrected return value of isCourseFull function
201 changes: 109 additions & 92 deletions IndividualMiniprojectC++/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,92 +1,109 @@
cmake_minimum_required(VERSION 3.15)

project(IndividualMiniproject)

set(INCLUDE_PATHS external_libraries/boost_1_85_0 external_libraries/Crow-1.2.0-Darwin/include)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Main project executable
add_executable(IndividualMiniproject
src/main.cpp
src/Course.cpp
src/Department.cpp
src/MyFileDatabase.cpp
src/RouteController.cpp
src/MyApp.cpp
src/Globals.cpp
)

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/ff233bdd4cac0a0bf6e5cd45bda3406814cb2796.zip
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)

FetchContent_MakeAvailable(googletest)

# Include directories for main executable
target_include_directories(IndividualMiniproject PUBLIC
${INCLUDE_PATHS}
include
/opt/homebrew/Cellar/asio/1.30.2/include
)

target_link_libraries(IndividualMiniproject PRIVATE
gtest
gtest_main
)

enable_testing()

# Test executable
add_executable(IndividualMiniprojectTests
test/sample.cpp
test/CourseUnitTests.cpp
src/Course.cpp
src/Department.cpp
src/MyFileDatabase.cpp
)

target_include_directories(IndividualMiniprojectTests PRIVATE
${INCLUDE_PATHS}
include
/opt/homebrew/Cellar/asio/1.30.2/include
)

target_link_libraries(IndividualMiniprojectTests PRIVATE
gtest
gtest_main
)

include(GoogleTest)
gtest_discover_tests(IndividualMiniprojectTests)

# Find the cpplint program
find_program(CPPLINT cpplint)

if (CPPLINT)
# List of source files to be checked by cpplint
set(SOURCE_FILES
src/main.cpp
src/Course.cpp
src/Department.cpp
src/MyFileDatabase.cpp
src/RouteController.cpp
src/MyApp.cpp
src/Globals.cpp
test/sample.cpp
test/CourseUnitTests.cpp
)

# Custom target to run cpplint
add_custom_target(
cpplint
COMMAND ${CPPLINT} --filter=-whitespace,-build/include_what_you_use ${SOURCE_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running cpplint for Google C++ Style Guide compliance"
)
else()
message(WARNING "cpplint not found! Skipping style checks.")
endif()
cmake_minimum_required(VERSION 3.15)

project(IndividualMiniproject)

set(INCLUDE_PATHS external_libraries/boost_1_85_0 external_libraries/Crow-1.2.0-Darwin/include external_libraries/asio-master/asio/include)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Main project executable
add_executable(IndividualMiniproject
src/main.cpp
src/Course.cpp
src/Department.cpp
src/MyFileDatabase.cpp
src/RouteController.cpp
src/MyApp.cpp
src/Globals.cpp
)

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/ff233bdd4cac0a0bf6e5cd45bda3406814cb2796.zip
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)

FetchContent_MakeAvailable(googletest)

# Include directories for main executable
target_include_directories(IndividualMiniproject PUBLIC
${INCLUDE_PATHS}
include
)

target_link_libraries(IndividualMiniproject PRIVATE
gtest
gtest_main
# ws2_32
# wsock32
)

enable_testing()

# Test executable
add_executable(IndividualMiniprojectTests
test/sample.cpp
test/CourseUnitTests.cpp
src/Course.cpp
src/Department.cpp
src/MyFileDatabase.cpp
)

target_include_directories(IndividualMiniprojectTests PRIVATE
${INCLUDE_PATHS}
include
/opt/homebrew/Cellar/asio/1.30.2/include
)

target_link_libraries(IndividualMiniprojectTests PRIVATE
gtest
gtest_main
)

include(GoogleTest)
gtest_discover_tests(IndividualMiniprojectTests)

# Find the cpplint program
find_program(CPPLINT cpplint)

if (CPPLINT)
# List of source files to be checked by cpplint
set(SOURCE_FILES
src/main.cpp
src/Course.cpp
src/Department.cpp
src/MyFileDatabase.cpp
src/RouteController.cpp
src/MyApp.cpp
src/Globals.cpp
test/sample.cpp
test/CourseUnitTests.cpp
)

# Custom target to run cpplint
add_custom_target(
cpplint
COMMAND ${CPPLINT} --filter=-whitespace,-build/include_what_you_use ${SOURCE_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running cpplint for Google C++ Style Guide compliance"
)
else()
message(WARNING "cpplint not found! Skipping style checks.")
endif()

# set compiler flags
set(CMAKE_CXX_FLAGS "-O0 -coverage")

set(CMAKE_BINARY_DIR ./CMakeFiles/IndividualMiniprojectTests.dir/src)
# find required tools
find_program(LCOV lcov REQUIRED)
find_program(GENHTML genhtml REQUIRED)

# add coverage target
add_custom_target(coverage
# gather data
COMMAND ${LCOV} --directory . --capture --output-file coverage.info
# generate report
COMMAND ${GENHTML} --demangle-cpp -o coverage coverage.info
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
12 changes: 12 additions & 0 deletions IndividualMiniprojectC++/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Rough work
Use of CMake - What does it do?
We were given **CMakeList.txt** file which contains configurations and build steps required to build the project. However, CMake cannot build it. It can merely create a **make file**, which in turn will call the compiler i.e. **g++** (in our case) to compile the project.

Cmake -------> Make ----------> g++
create make file calls g++ for multiple files Actually compile

Why didn't we use g++ directly to compile?
g++ will compile each file separately hence we needed a tool (Make) to compile the whole project at once (useful for large projects)

We needed cmake and gcc (compiler). For this, we installed a tool called MSYS2 which used "pacman" to install these two.
Build commands -> "cmake ." (created make files) then "make" (compilation of the project by calling g++)
68 changes: 34 additions & 34 deletions IndividualMiniprojectC++/include/Course.h
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
#include <string>
#ifndef COURSE_H
#define COURSE_H

class Course {
private:
int enrollmentCapacity;
int enrolledStudentCount;
std::string courseLocation;
std::string instructorName;
std::string courseTimeSlot;

public:
Course(int count, const std::string &instructorName, const std::string &courseLocation, const std::string &timeSlot);
Course();

std::string getCourseLocation() const;
std::string getInstructorName() const;
std::string getCourseTimeSlot() const;
std::string display() const;


bool isCourseFull() const;
bool enrollStudent();
bool dropStudent();

void reassignInstructor(const std::string &newInstructorName);
void reassignLocation(const std::string &newLocation);
void reassignTime(const std::string &newTime);
void setEnrolledStudentCount(int count);
void serialize(std::ostream& out) const;
void deserialize(std::istream& in);
};

#include <string>
#ifndef COURSE_H
#define COURSE_H
class Course {
private:
int enrollmentCapacity;
int enrolledStudentCount;
std::string courseLocation;
std::string instructorName;
std::string courseTimeSlot;
public:
Course(int count, const std::string &instructorName, const std::string &courseLocation, const std::string &timeSlot);
Course();
std::string getCourseLocation() const;
std::string getInstructorName() const;
std::string getCourseTimeSlot() const;
std::string display() const;
bool isCourseFull() const;
bool enrollStudent();
bool dropStudent();
void reassignInstructor(const std::string &newInstructorName);
void reassignLocation(const std::string &newLocation);
void reassignTime(const std::string &newTime);
void setEnrolledStudentCount(int count);
void serialize(std::ostream& out) const;
void deserialize(std::istream& in);
};
#endif
Loading
Loading