diff --git a/include/FileUtil.h b/include/FileUtils.h similarity index 58% rename from include/FileUtil.h rename to include/FileUtils.h index 6fd990c..af88b6e 100644 --- a/include/FileUtil.h +++ b/include/FileUtils.h @@ -1,16 +1,16 @@ -#ifndef FILEUTIL_H -#define FILEUTIL_H +#ifndef FILEUTILS_H +#define FILEUTILS_H #include #include using namespace std; -class FileUtil { +class FileUtils { public: - FileUtil() = default; + FileUtils() = default; - ~FileUtil() = default; + ~FileUtils() = default; static string getFile(char *path); static bool fileExists(char *path); diff --git a/makefile b/makefile index 8c8fcaf..bd2c20a 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ # Makefile for hello.c CC = g++ -CFLAGS = -O2 -Wall -g +CFLAGS = -O2 SRC_DIR = src BUILD_DIR = build diff --git a/src/FileUtil.cpp b/src/FileUtils.cpp similarity index 78% rename from src/FileUtil.cpp rename to src/FileUtils.cpp index 9d5278e..18aa970 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtils.cpp @@ -1,9 +1,9 @@ -#include "../include/FileUtil.h" +#include "../include/FileUtils.h" #include #include #include -bool FileUtil::fileExists(char *path){ +bool FileUtils::fileExists(char *path){ struct stat s; // Check if file exists, and if it isn't a folder. @@ -14,7 +14,7 @@ bool FileUtil::fileExists(char *path){ return false; } -string FileUtil::getFile(char *path){ +string FileUtils::getFile(char *path){ ifstream file(path); string line; diff --git a/src/NumberUtil.cpp b/src/NumberUtils.cpp similarity index 100% rename from src/NumberUtil.cpp rename to src/NumberUtils.cpp diff --git a/src/main.cpp b/src/main.cpp index fe363e8..8519dc0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,6 @@ #include #include -#include "../include/FileUtil.h" +#include "../include/FileUtils.h" #include "../include/NumberUtils.h" #include "../include/ScoreCalculator.h" #include "../include/PrintFrames.h" @@ -13,12 +13,12 @@ int main(int argc, char *argv[]) { return 0; } - if (!FileUtil::fileExists(argv[1])) { + if (!FileUtils::fileExists(argv[1])) { cerr << "Filepath: " << argv[1] << " doesn't exist."; return 0; } - string file = FileUtil::getFile(argv[1]); + string file = FileUtils::getFile(argv[1]); vector rolls = NumberUtils::getRolls(file); if (!NumberUtils::validateRolls(rolls)) { diff --git a/test rolls/rolls2.txt b/test rolls/rolls2.txt new file mode 100644 index 0000000..2daa3f9 --- /dev/null +++ b/test rolls/rolls2.txt @@ -0,0 +1 @@ +10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 diff --git a/test rolls/rolls3.txt b/test rolls/rolls3.txt new file mode 100644 index 0000000..b32232c --- /dev/null +++ b/test rolls/rolls3.txt @@ -0,0 +1 @@ +5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 diff --git a/test rolls/rolls4.txt b/test rolls/rolls4.txt new file mode 100644 index 0000000..cd432e6 --- /dev/null +++ b/test rolls/rolls4.txt @@ -0,0 +1 @@ +5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 5, 5 diff --git a/test rolls/rolls5.txt b/test rolls/rolls5.txt new file mode 100644 index 0000000..9a56ce2 --- /dev/null +++ b/test rolls/rolls5.txt @@ -0,0 +1 @@ +5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 10, 10