Changed header names to be more consistent

This commit is contained in:
Rasmus Rasmussen 2025-03-27 21:44:51 +01:00
parent 2ec206b5bb
commit 2778a490a7
9 changed files with 16 additions and 12 deletions

View File

@ -1,16 +1,16 @@
#ifndef FILEUTIL_H
#define FILEUTIL_H
#ifndef FILEUTILS_H
#define FILEUTILS_H
#include <string>
#include <vector>
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);

View File

@ -1,7 +1,7 @@
# Makefile for hello.c
CC = g++
CFLAGS = -O2 -Wall -g
CFLAGS = -O2
SRC_DIR = src
BUILD_DIR = build

View File

@ -1,9 +1,9 @@
#include "../include/FileUtil.h"
#include "../include/FileUtils.h"
#include <string>
#include <fstream>
#include <sys/stat.h>
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;

View File

@ -1,6 +1,6 @@
#include <iostream>
#include <string>
#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<int> rolls = NumberUtils::getRolls(file);
if (!NumberUtils::validateRolls(rolls)) {

1
test rolls/rolls2.txt Normal file
View File

@ -0,0 +1 @@
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10

1
test rolls/rolls3.txt Normal file
View File

@ -0,0 +1 @@
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5

1
test rolls/rolls4.txt Normal file
View File

@ -0,0 +1 @@
5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 5, 5

1
test rolls/rolls5.txt Normal file
View File

@ -0,0 +1 @@
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 10, 10