Compare commits
No commits in common. "23e962c994a3c26efcb392c5079471822724eb16" and "5ba3bc24d037879fa8387ae1fe7d3901eb0c8a90" have entirely different histories.
23e962c994
...
5ba3bc24d0
2
.gitignore
vendored
2
.gitignore
vendored
@ -32,5 +32,3 @@
|
|||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
/build/
|
|
||||||
build/
|
|
BIN
.vscode/browse.vc.db
vendored
BIN
.vscode/browse.vc.db
vendored
Binary file not shown.
BIN
.vscode/browse.vc.db-shm
vendored
BIN
.vscode/browse.vc.db-shm
vendored
Binary file not shown.
BIN
.vscode/browse.vc.db-wal
vendored
BIN
.vscode/browse.vc.db-wal
vendored
Binary file not shown.
2
.vscode/c_cpp_properties.json
vendored
2
.vscode/c_cpp_properties.json
vendored
@ -16,7 +16,7 @@
|
|||||||
"compilerPath": "/usr/bin/gcc",
|
"compilerPath": "/usr/bin/gcc",
|
||||||
"cStandard": "${default}",
|
"cStandard": "${default}",
|
||||||
"cppStandard": "${default}",
|
"cppStandard": "${default}",
|
||||||
"compileCommands": "./build/compile_commands.json",
|
"compileCommands": "build/compile_commands.json",
|
||||||
"browse": {
|
"browse": {
|
||||||
"path": [
|
"path": [
|
||||||
"${workspaceFolder}/**",
|
"${workspaceFolder}/**",
|
||||||
|
@ -31,7 +31,6 @@ set(SOURCES
|
|||||||
src/DataLoad.cpp
|
src/DataLoad.cpp
|
||||||
src/BendDeduction.cpp
|
src/BendDeduction.cpp
|
||||||
src/FormingTool.cpp
|
src/FormingTool.cpp
|
||||||
src/BendAllowance.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create executable
|
# Create executable
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# BendCalc
|
# BendCalc
|
||||||
|
|
||||||
A C++ Bend calculator application for sheet metal bending and forming calculations used in the sheet metal and forming and fabrication trades
|
A C++ Bend calculator for sheet metal bending and forming calculations used in the sheet metal and forming and fabrication trades
|
||||||
|
|
||||||
This calculators features include:
|
This calculators features include:
|
||||||
|
|
||||||
@ -9,4 +9,4 @@ This calculators features include:
|
|||||||
- Saving and Loading bend history/historical data for review and analysis, including to and from the machine (if applicable)
|
- Saving and Loading bend history/historical data for review and analysis, including to and from the machine (if applicable)
|
||||||
- Calculating the required press tonnage required to complete bends and forming operations
|
- Calculating the required press tonnage required to complete bends and forming operations
|
||||||
- Tool library. Store tool data including a tool library
|
- Tool library. Store tool data including a tool library
|
||||||
- Calcuating inside and outside setback
|
-
|
197
ask.txt
197
ask.txt
@ -1,197 +0,0 @@
|
|||||||
I am making a C++ program that is written in C++ 11 and uses CMake. It is meant for doing calculations for
|
|
||||||
bending sheet metal / sheetmetal for pressbrakes, press brakes, brakeforms, breakforms, brake forms, break forms, forming and forming machinery and metalforming machinery and sheetmetal forming machinery.
|
|
||||||
|
|
||||||
The /BendCalc folder/directory includes:
|
|
||||||
|
|
||||||
CMakeLists.txt data docs include LICENSE README.md src tests
|
|
||||||
|
|
||||||
data is a directcory
|
|
||||||
docs is a directory
|
|
||||||
include is a directory
|
|
||||||
LICENSE is the project license
|
|
||||||
README.md is for GitHub
|
|
||||||
src is a directory
|
|
||||||
tests is a directory
|
|
||||||
|
|
||||||
currently data is empty. this is the place for stored data to and from the machine (using a paralel or serial pot or inputted from the user or saved by this program
|
|
||||||
|
|
||||||
docs is the documentation for the BendCalc program in markdown format. it contains
|
|
||||||
|
|
||||||
BendAllowance.md BendDeduction.md KFactor.md Setback.md Tonnage.md
|
|
||||||
|
|
||||||
include contains header files:
|
|
||||||
|
|
||||||
BendAllowance.h DataLoad.h Deserializer.h Kfactor.h Setback.h
|
|
||||||
BendDeduction.h DataSave.h FormingTool.h Serializer.h Tonnage.h
|
|
||||||
|
|
||||||
src contains the cpp files:
|
|
||||||
|
|
||||||
BendAllowance.cpp DataLoad.cpp Deserializer.cpp Kfactor.cpp Serializer.cpp Tonnage.cpp
|
|
||||||
BendDeduction.cpp DataSave.cpp FormingTool.cpp main.cpp Setback.cpp
|
|
||||||
|
|
||||||
main is the entrypoint to the program. the rest are classes.
|
|
||||||
|
|
||||||
tests is currently empty and will be using google test
|
|
||||||
|
|
||||||
CMakeLists.txt is currently
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.13.4)
|
|
||||||
project(BendCalc
|
|
||||||
VERSION 1.0.0
|
|
||||||
DESCRIPTION "An application for "
|
|
||||||
HOMEPAGE_URL "https://gitea.eventhorizonstudio.io/gbowne1/BendCalc"
|
|
||||||
LANGUAGES CXX)
|
|
||||||
|
|
||||||
include(CTest)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
# Set C++ standard
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
|
|
||||||
set(CMAKE_BUILD_TYPE Debug)
|
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
||||||
|
|
||||||
add_compile_options(-g -Wall -Wextra -Werror -pedantic)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILER /usr/bin/g++)
|
|
||||||
|
|
||||||
# Source files
|
|
||||||
set(SOURCES
|
|
||||||
src/main.cpp
|
|
||||||
src/Tonnage.cpp
|
|
||||||
src/Setback.cpp
|
|
||||||
src/Serializer.cpp
|
|
||||||
src/Kfactor.cpp
|
|
||||||
src/Deserializer.cpp
|
|
||||||
src/DataSave.cpp
|
|
||||||
src/DataLoad.cpp
|
|
||||||
src/BendDeduction.cpp
|
|
||||||
src/FormingTool.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Create executable
|
|
||||||
add_executable(bendcalc ${SOURCES})
|
|
||||||
|
|
||||||
# Include directories
|
|
||||||
target_include_directories(bendcalc PUBLIC include)
|
|
||||||
|
|
||||||
and the main.cpp entrypoint file is
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <array>
|
|
||||||
#include <cassert>
|
|
||||||
#include <cctype>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <chrono>
|
|
||||||
#include <cmath>
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
#include <ctime>
|
|
||||||
#include <fstream>
|
|
||||||
#include <functional>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <iostream>
|
|
||||||
#include <iterator>
|
|
||||||
#include <memory>
|
|
||||||
#include <mutex>
|
|
||||||
#include <random>
|
|
||||||
#include <regex>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
#include <thread>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "../include/BendAllowance.h"
|
|
||||||
#include "../include/BendDeduction.h"
|
|
||||||
#include "../include/DataLoad.h"
|
|
||||||
#include "../include/DataSave.h"
|
|
||||||
#include "../include/Deserializer.h"
|
|
||||||
#include "../include/FormingTool.h"
|
|
||||||
#include "../include/Kfactor.h"
|
|
||||||
#include "../include/Serializer.h"
|
|
||||||
#include "../include/Setback.h"
|
|
||||||
#include "../include/Tonnage.h"
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
|
|
||||||
DataLoad::loadDataFromCSV(/*fileName*/);
|
|
||||||
|
|
||||||
std::cout << "Welcome to BendCalc - Metal Forming and Bending Operations Calculator\n";
|
|
||||||
std::cout << "Select an operation:\n";
|
|
||||||
std::cout << "1. Calculate Bend Deduction\n";
|
|
||||||
std::cout << "2. Load Data\n";
|
|
||||||
std::cout << "3. Save Data\n";
|
|
||||||
std::cout << "4. Exit\n";
|
|
||||||
std::cout << "Enter your choice: ";
|
|
||||||
|
|
||||||
int choice;
|
|
||||||
std::cin >> choice;
|
|
||||||
|
|
||||||
switch (choice) {
|
|
||||||
case 1:
|
|
||||||
// **Calculate Bend Deduction**
|
|
||||||
// Get user input for bend parameters
|
|
||||||
double bendAngleDegrees;
|
|
||||||
double insideRadius;
|
|
||||||
double materialThickness;
|
|
||||||
double kFactor;
|
|
||||||
|
|
||||||
std::cout << "Enter bend angle (degrees): ";
|
|
||||||
std::cin >> bendAngleDegrees;
|
|
||||||
|
|
||||||
std::cout << "Enter inside bend radius (mm): ";
|
|
||||||
std::cin >> insideRadius;
|
|
||||||
|
|
||||||
std::cout << "Enter material thickness (mm): ";
|
|
||||||
std::cin >> materialThickness;
|
|
||||||
|
|
||||||
std::cout << "Enter K-factor: ";
|
|
||||||
std::cin >> kFactor;
|
|
||||||
|
|
||||||
// Create a BendDeduction object with user-provided values
|
|
||||||
BendDeduction bendCalculator(bendAngleDegrees, insideRadius, materialThickness, kFactor);
|
|
||||||
|
|
||||||
// Call the object's method to calculate bend deduction
|
|
||||||
double bendDeduction = bendCalculator.calculateBendDeduction();
|
|
||||||
|
|
||||||
// Display the result
|
|
||||||
std::cout << "Bend Deduction: " << bendDeduction << " mm\n";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
// Call function to load data (implementation pending) // Load Data
|
|
||||||
std::string fileName;
|
|
||||||
std::cout << "Enter the CSV file name to load: ";
|
|
||||||
std::cin >> fileName;
|
|
||||||
|
|
||||||
DataLoad::loadDataFromCSV(fileName); // Call the static method
|
|
||||||
|
|
||||||
std::cout << "Data loaded (assuming successful parsing).\n";
|
|
||||||
std::cout << "Data is already loaded.\n";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
// Save Data
|
|
||||||
std::string fileName;
|
|
||||||
std::string dataToSave;
|
|
||||||
|
|
||||||
std::cout << "Enter the CSV file name to save: ";
|
|
||||||
std::cin >> fileName;
|
|
||||||
|
|
||||||
std::cout << "Enter the data to save: ";
|
|
||||||
std::cin >> dataToSave;
|
|
||||||
|
|
||||||
DataSave::saveDataToCSV(fileName, dataToSave);
|
|
||||||
|
|
||||||
std::cout << "Data saved successfully.\n";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
std::cout << "Exiting...\n";
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
std::cout << "Invalid choice. Please try again.\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace DataLoad {
|
|
||||||
struct BendData {
|
|
||||||
double bendAngleDegrees;
|
|
||||||
double insideRadius;
|
|
||||||
double materialThickness;
|
|
||||||
double kFactor;
|
|
||||||
};
|
|
||||||
}
|
|
@ -9,7 +9,7 @@ private:
|
|||||||
double kFactor; // K-factor
|
double kFactor; // K-factor
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BendDeduction(double bendAngleDegrees, double radius, double thickness, double k);
|
BendDeduction(double angleDegrees, double radius, double thickness, double k);
|
||||||
double calculateBendDeduction();
|
double calculateBendDeduction();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#include "BendData.h"
|
|
||||||
|
|
||||||
#ifndef DATALOAD_H
|
|
||||||
#define DATALOAD_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace DataLoad {
|
|
||||||
void loadDataFromCSV(const std::string& fileName, BendData& bendData);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||||||
#ifndef DATASAVE_H
|
|
||||||
#define DATASAVE_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
void saveDataToCSV(const std::string& fileName, const std::string& data);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,17 +1,25 @@
|
|||||||
#include "../include/BendDeduction.h"
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
class BendDeduction {
|
||||||
|
private:
|
||||||
|
double bendAngleRadians; // Bend angle in radians
|
||||||
|
double insideRadius; // Inside radius of the bend
|
||||||
|
double materialThickness; // Thickness of the material
|
||||||
|
double kFactor; // K-factor
|
||||||
|
|
||||||
|
public:
|
||||||
// Constructor to initialize the properties
|
// Constructor to initialize the properties
|
||||||
BendDeduction::BendDeduction(double angleDegrees, double radius, double thickness, double k)
|
BendDeduction(double angleDegrees, double radius, double thickness, double k)
|
||||||
: bendAngleRadians(angleDegrees * M_PI / 180.0), // Convert degrees to radians
|
: bendAngleRadians(angleDegrees * M_PI / 180.0), // Convert degrees to radians
|
||||||
insideRadius(radius),
|
insideRadius(radius),
|
||||||
materialThickness(thickness),
|
materialThickness(thickness),
|
||||||
kFactor(k) {}
|
kFactor(k) {}
|
||||||
|
|
||||||
// Method to calculate the bend deduction
|
// Method to calculate the bend deduction
|
||||||
double BendDeduction::calculateBendDeduction() {
|
double calculateBendDeduction() {
|
||||||
double ossb = (insideRadius + materialThickness) * tan(bendAngleRadians / 2.0);
|
double ossb = (insideRadius + materialThickness) * tan(bendAngleRadians / 2.0);
|
||||||
double ba = (M_PI / 180.0) * bendAngleRadians * (insideRadius + kFactor * materialThickness);
|
double ba = (M_PI / 180.0) * bendAngleRadians * (insideRadius + kFactor * materialThickness);
|
||||||
double bd = 2 * ossb - ba;
|
double bd = 2 * ossb - ba;
|
||||||
return bd;
|
return bd;
|
||||||
}
|
}
|
||||||
|
};
|
@ -1,41 +1,17 @@
|
|||||||
#include "../include/BendData.h"
|
|
||||||
#include "../include/DataLoad.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace DataLoad {
|
void loadDataFromCSV(const std::string& fileName) {
|
||||||
|
|
||||||
void loadDataFromCSV(const std::string& fileName, BendData& bendData) {
|
|
||||||
std::ifstream file(fileName);
|
std::ifstream file(fileName);
|
||||||
if (!file.is_open()) {
|
if (file.is_open()) {
|
||||||
std::cerr << "Failed to open the file: " << fileName << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
std::stringstream ss(line);
|
// Process the line, e.g., parse and store the data
|
||||||
std::string item;
|
std::cout << line << std::endl; // Example: Output the line
|
||||||
std::vector<double> data;
|
|
||||||
while (std::getline(ss, item, ',')) {
|
|
||||||
data.push_back(std::stod(item));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assuming the order of data in the CSV matches the fields in BendData
|
|
||||||
if (data.size() == 4) {
|
|
||||||
bendData.bendAngleDegrees = data[0];
|
|
||||||
bendData.insideRadius = data[1];
|
|
||||||
bendData.materialThickness = data[2];
|
|
||||||
bendData.kFactor = data[3];
|
|
||||||
} else {
|
|
||||||
std::cerr << "Unexpected number of items in line: " << line << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
} else {
|
||||||
|
std::cerr << "Failed to open the file: " << fileName << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
136
src/main.cpp
136
src/main.cpp
@ -1,33 +1,59 @@
|
|||||||
#include <iostream>
|
/*
|
||||||
|
* This file is part of <project name>.
|
||||||
|
*
|
||||||
|
* <project name> is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the <license name> as published by
|
||||||
|
* the <license organization>, either version <license version> of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* <project name> is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* <license name> for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the <license name>
|
||||||
|
* along with <project name>. If not, see <license URL>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cctype>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <chrono>
|
||||||
|
#include <cmath>
|
||||||
|
#include <condition_variable>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <ctime>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <functional>
|
||||||
#include <vector>
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iterator>
|
||||||
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
|
#include <random>
|
||||||
|
#include <regex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "../include/BendData.h"
|
#include "BendAllowance.h"
|
||||||
#include "../include/BendAllowance.h"
|
#include "BendDeduction.h"
|
||||||
#include "../include/BendDeduction.h"
|
#include "DataLoad.h"
|
||||||
#include "../include/DataLoad.h"
|
#include "DataSave.h"
|
||||||
#include "../include/DataSave.h"
|
#include "Deserializer.h"
|
||||||
#include "../include/Deserializer.h"
|
#include "FormingTool.h"
|
||||||
#include "../include/FormingTool.h"
|
#include "Kfactor.h"
|
||||||
#include "../include/Kfactor.h"
|
#include "Serializer.h"
|
||||||
#include "../include/Serializer.h"
|
#include "Setback.h"
|
||||||
#include "../include/Setback.h"
|
#include "Tonnage.h"
|
||||||
#include "../include/Tonnage.h"
|
|
||||||
|
|
||||||
int main()
|
int main() {
|
||||||
{
|
|
||||||
std::string fileName;
|
|
||||||
std::string dataToSave;
|
|
||||||
|
|
||||||
// Welcome message
|
|
||||||
std::cout << "Welcome to BendCalc - Metal Forming and Bending Operations Calculator\n";
|
std::cout << "Welcome to BendCalc - Metal Forming and Bending Operations Calculator\n";
|
||||||
|
std::cout << "Select an operation:\n";
|
||||||
// Main menu loop
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
std::cout << "\nSelect an operation:\n";
|
|
||||||
std::cout << "1. Calculate Bend Deduction\n";
|
std::cout << "1. Calculate Bend Deduction\n";
|
||||||
std::cout << "2. Load Data\n";
|
std::cout << "2. Load Data\n";
|
||||||
std::cout << "3. Save Data\n";
|
std::cout << "3. Save Data\n";
|
||||||
@ -37,69 +63,25 @@ int main()
|
|||||||
int choice;
|
int choice;
|
||||||
std::cin >> choice;
|
std::cin >> choice;
|
||||||
|
|
||||||
switch (choice)
|
switch (choice) {
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
{
|
// Call function to calculate bend deduction
|
||||||
// Calculate Bend Deduction
|
|
||||||
std::cout << "Enter bend angle (degrees): ";
|
|
||||||
double bendAngleDegrees;
|
|
||||||
std::cin >> bendAngleDegrees;
|
|
||||||
|
|
||||||
std::cout << "Enter inside bend radius (mm): ";
|
|
||||||
double insideRadius;
|
|
||||||
std::cin >> insideRadius;
|
|
||||||
|
|
||||||
std::cout << "Enter material thickness (mm): ";
|
|
||||||
double materialThickness;
|
|
||||||
std::cin >> materialThickness;
|
|
||||||
|
|
||||||
std::cout << "Enter K-factor: ";
|
|
||||||
double kFactor;
|
|
||||||
std::cin >> kFactor;
|
|
||||||
|
|
||||||
BendDeduction bendCalculator(bendAngleDegrees, insideRadius, materialThickness, kFactor);
|
|
||||||
double bendDeduction = bendCalculator.calculateBendDeduction();
|
|
||||||
std::cout << "Bend Deduction: " << bendDeduction << " mm\n";
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
// Call function to load data
|
||||||
// Load Data
|
|
||||||
std::cout << "Enter the CSV file name to load: ";
|
|
||||||
std::cin >> fileName;
|
|
||||||
|
|
||||||
DataLoad::BendData bendData; // Declare a BendData instance
|
|
||||||
DataLoad::loadDataFromCSV(fileName, bendData); // Pass the BendData instance
|
|
||||||
|
|
||||||
std::cout << "Data loaded (assuming successful parsing).\n";
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 3:
|
case 3:
|
||||||
{
|
// Call function to save data
|
||||||
// Save Data
|
|
||||||
std::cout << "Enter the CSV file name to save: ";
|
|
||||||
std::cin >> fileName;
|
|
||||||
std::cout << "Enter the data to save: ";
|
|
||||||
std::cin.ignore(); // Ignore the newline character left by std::cin >> fileName
|
|
||||||
std::getline(std::cin, dataToSave);
|
|
||||||
saveDataToCSV(fileName, dataToSave);
|
|
||||||
std::cout << "Data saved successfully.\n";
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 4:
|
case 4:
|
||||||
{
|
|
||||||
// Exit
|
|
||||||
std::cout << "Exiting...\n";
|
std::cout << "Exiting...\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
std::cout << "Invalid choice. Please try again.\n";
|
std::cout << "Invalid choice. Please try again.\n";
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; // This line will never be reached due to the infinite loop above
|
// Loop back to menu or exit based on user input
|
||||||
|
// Implement functionality for each case
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
@ -1,16 +0,0 @@
|
|||||||
#define DATA_LOAD_TEST_SOURCE DataLoadTest.cpp
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "DataLoad.h"
|
|
||||||
|
|
||||||
TEST(DataLoadTest, LoadsDataFromFile) {
|
|
||||||
const std::string testFile = "test_data.csv"; // Ensure this file exists and has the correct format
|
|
||||||
DataLoad::loadDataFromCSV(testFile);
|
|
||||||
|
|
||||||
// Add assertions here to check if the data was loaded correctly
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user