From 911df91f60487eb40018e783e4db36838804ba6c Mon Sep 17 00:00:00 2001 From: Ziad Arafat Date: Thu, 23 Mar 2023 12:55:01 -0600 Subject: [PATCH] created folder for PA5 --- PA005/.gitignore | 10 +++++++ PA005/Makefile | 39 +++++++++++++++++++++++++ PA005/README.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 PA005/.gitignore create mode 100644 PA005/Makefile create mode 100644 PA005/README.md diff --git a/PA005/.gitignore b/PA005/.gitignore new file mode 100644 index 0000000..ceb045a --- /dev/null +++ b/PA005/.gitignore @@ -0,0 +1,10 @@ +*.o +*.mod +gaussian_elimination +matrix.txt +# test.txt +out.txt +out_python.txt +out_java.txt +out_perl.txt +.ipynb_checkpoints diff --git a/PA005/Makefile b/PA005/Makefile new file mode 100644 index 0000000..3eb166c --- /dev/null +++ b/PA005/Makefile @@ -0,0 +1,39 @@ +red=`tput setaf 1` +green=`tput setaf 2` +reset=`tput sgr0` + +# Variables so its easy to make changes if I need to (it ended up being helpful) + +all: setup_perl + +setup_perl: + cpan File::Slurp + +test: test_python test_perl test_java + @echo "${green}###### ORIGINAL FILE ######${reset}" + cat test.txt + +test_python: out_python.txt + @echo "${green}###### PYTHON RESULT ######${reset}" + @cat out_python.txt + +test_perl: out_perl.txt + @echo "${green}###### PERL RESULT ######${reset}" + @cat out_perl.txt + +test_java: out_java.txt + @echo "${green}###### JAVA RESULT ######${reset}" + @cat out_java.txt + + +out_python.txt: test.txt + python3 clean_file.py test.txt -o out_python.txt + +out_perl.txt: test.txt + perl clean_file.pl --input_file_path test.txt --output_file_path out_perl.txt + +out_java.txt: test.txt + java CleanFile.java test.txt out_java.txt + +clean: + rm -rf out_java.txt out_python.txt out_perl.txt diff --git a/PA005/README.md b/PA005/README.md new file mode 100644 index 0000000..b978ac7 --- /dev/null +++ b/PA005/README.md @@ -0,0 +1,76 @@ + +## Usage + +### Testing each language +1. setup the perl dependency +```bash +make +``` +or +```bash +make setup_perl +``` + +2. run all the tests. This will print the result of each language then print the original file. + +```bash +make test +``` + +3. Run individual tests +```bash +make test_python +make test_perl +make test_java +``` + +4. Delete output files + +```bash +make clean +``` + +### Executing The python program +1. Usage +```bash +# Only the input file path is a required positional argument. +# If the output is left out it will print it to stdout +usage: clean_file.py [-h] [-o OUTPUT_FILE_PATH] input_file_path +``` +2. Examples + +```bash +python3 clean_file.py test.txt +python3 clean_file.py test.txt -o out.txt +``` + +### Executing The perl program +1. Usage +```bash +# Only the input file path is a required argument. +# If the output is left out it will print it to stdout +Usage: clean_file.pl --input_file_path INPUT_FILE_PATH [--output_file_path OUTPUT_FILE_PATH] + +``` +2. Examples + +``` +perl clean_file.pl --input_file_path test.txt +perl clean_file.pl --input_file_path test.txt --output_file_path out.txt +``` + +### Executing The java program +1. Usage +```bash +# Only the input file path is a required positional argument. +# If the output is left out it will print it to stdout +Usage: CleanFile [] + +``` +2. Examples + +``` +java CleanFile.java test.txt +java CleanFile.java test.txt out.txt +``` +