From 5919106c0383b5eced4c65c5884ce3261cd6895e Mon Sep 17 00:00:00 2001 From: TJSidhu1 Date: Tue, 21 Feb 2023 10:28:20 -0800 Subject: [PATCH 1/5] Fix style issues reported by cpplint, FIX#1 --- GameDie.cpp | 2 +- main.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/GameDie.cpp b/GameDie.cpp index d8ecb3a..92673c9 100644 --- a/GameDie.cpp +++ b/GameDie.cpp @@ -29,7 +29,7 @@ GameDie::GameDie(unsigned int num) { // generate a random number between 1-n where n is the counter size // (inclusive) and return it int GameDie::roll() { - int roll = rand_r() % roll_counter.size(); + int roll = random() % roll_counter.size(); roll_counter[roll]++; return roll + 1; } diff --git a/main.cpp b/main.cpp index 65055f9..39efd65 100644 --- a/main.cpp +++ b/main.cpp @@ -7,7 +7,7 @@ using std::cout; using std::endl; int main(int argc, char *argv[]) { - if ( argc != 2 || std::atoi(argv[1]) < 1 ){ + if ( argc != 2 || std::atoi(argv[1]) < 1 ) { cout << "Incorrect command.\n" << "Format: ./Roller \n" << "--------------------\n" @@ -15,8 +15,7 @@ int main(int argc, char *argv[]) { << "--------------------\n" << " - Required; a number 1 or greater representing the number\n" << " of faces on the die being rolled\n"; - } - else { + } else { int faces = std::atoi(argv[1]); GameDie die(faces); cout << die.roll() << endl; From 3a0dcc07443059146ba1ae36466a4a46444cf531 Mon Sep 17 00:00:00 2001 From: TJSidhu1 <124082232+TJSidhu1@users.noreply.github.com> Date: Tue, 21 Feb 2023 17:14:46 -0800 Subject: [PATCH 2/5] Create actions.yml --- github/workflows/actions.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 github/workflows/actions.yml diff --git a/github/workflows/actions.yml b/github/workflows/actions.yml new file mode 100644 index 0000000..d5fd2df --- /dev/null +++ b/github/workflows/actions.yml @@ -0,0 +1,17 @@ +name: actions + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: make + run: make From 9586b44c323e058a8bc65dedd68d594d2c602f7e Mon Sep 17 00:00:00 2001 From: TJSidhu1 <124082232+TJSidhu1@users.noreply.github.com> Date: Tue, 21 Feb 2023 17:15:50 -0800 Subject: [PATCH 3/5] Create cpp-linter.yml --- github/workflows/cpp-linter.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 github/workflows/cpp-linter.yml diff --git a/github/workflows/cpp-linter.yml b/github/workflows/cpp-linter.yml new file mode 100644 index 0000000..fb48799 --- /dev/null +++ b/github/workflows/cpp-linter.yml @@ -0,0 +1,16 @@ +name: CPP-linter +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build + run: | + docker build -t my-cpp-app . + docker run my-cpp-app cpplint *.cpp *.h From 2f916e3a7c6ff5564a49e3c7a037a137b24a9ff7 Mon Sep 17 00:00:00 2001 From: TJSidhu1 <124082232+TJSidhu1@users.noreply.github.com> Date: Tue, 21 Feb 2023 17:16:35 -0800 Subject: [PATCH 4/5] Update main.cpp --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 65055f9..c0073df 100644 --- a/main.cpp +++ b/main.cpp @@ -5,7 +5,7 @@ using std::cout; using std::endl; - +//add files int main(int argc, char *argv[]) { if ( argc != 2 || std::atoi(argv[1]) < 1 ){ cout << "Incorrect command.\n" From 294bea55ed6546c4da83ad747fa4785e4255373b Mon Sep 17 00:00:00 2001 From: TJSidhu1 Date: Tue, 21 Feb 2023 17:21:04 -0800 Subject: [PATCH 5/5] Adding CI Workflow, Resolved#2 --- main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/main.cpp b/main.cpp index e3aaffd..4e57e64 100644 --- a/main.cpp +++ b/main.cpp @@ -5,7 +5,6 @@ using std::cout; using std::endl; -//add files int main(int argc, char *argv[]) { if ( argc != 2 || std::atoi(argv[1]) < 1 ) { cout << "Incorrect command.\n"