9511_project03

project 3 for algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README LICENSE
commit bc9c7b0060e88220486c9e3a879ce7ff82218d85
parent 2d30798beca76b4e1ab3a37c45b75eeb687c3d9b
Author: klewer-martin <martin.cachari@gmail.com>
Date:   Thu, 22 Jul 2021 18:27:28 -0300

Update: added a test script and cleaned files

Diffstat:
MMakefile | 27---------------------------
Minclude/io.h | 9+++++++++
Msource/io.c | 9---------
Msource/main.c | 4+++-
Atest.sh | 22++++++++++++++++++++++
5 files changed, 34 insertions(+), 37 deletions(-)
diff --git a/Makefile b/Makefile
@@ -29,30 +29,3 @@ user.o: $(HFOLDER)/status.h
 
 clean:
     rm *.o
-
-run20:
-    ./main -fmt csv -out output.csv -in examples/test_file_20.csv -ti 1320498000 -tf 1320498046
-
-run2k:
-    ./main -fmt csv -out output.csv -in examples/test_file_2k.csv -ti 1320498000 -tf 1325499000
-
-run50:
-    ./main -fmt csv -out output.csv -in examples/test_file_50.csv -ti 1320498000 -tf 1320498049
-
-run500:
-    ./main -fmt csv -out output.csv -in examples/test_file_500.csv -ti 1320498000 -tf 1320529000
-
-run5k:
-    ./main -fmt csv -out output.csv -in examples/test_file_5k.csv -ti 1320498000 -tf 1320529000
-
-run50k:
-    ./main -fmt csv -out output.csv -in examples/test_file_50k.csv -ti 1320498000 -tf 1420529000
-
-run500k:
-    ./main -fmt csv -out output.csv -in examples/test_file_500k.csv -ti 1320498000 -tf 1420529000
-
-run50xml:
-    ./main -fmt xml -out output.xml -in examples/test_file_50.csv -ti 1320498000 -tf 1320498049
-
-run5kxml:
-    ./main -fmt xml -out output.xml -in examples/test_file_5k.csv -ti 1320498000 -tf 1360498049
diff --git a/include/io.h b/include/io.h
@@ -14,8 +14,11 @@
 #define __USE_XOPEN
 #include <time.h>
 
+#define INIT_SIZE        1000
 #define INPUT_FILE_FIELDS 6
+
 #define BUFFER_SIZE        1000
+#define GROWTH_FACTOR     2
 
 #define INPUT_FILE_DELIM ","
 #define CSV_OUTPUT_DELIM    ","
@@ -52,8 +55,14 @@ status_t string_split(char *s, char **data, char *delim);
 status_t load_values(FILE *, cla_t *data);
 
 status_t export_data(cla_t cla, const user_t *users, size_t size);
+void clean_data(char **data);
 
 status_t export_data_as_csv(FILE *fo, const user_t *users, size_t size);
 status_t export_data_as_xml(FILE *fo, const user_t *users, size_t size);
 
+status_t destroy_data(char **data);
+status_t get_date(time_t *e, char **data);
+
+void clean_buffer(char *buf);
+
 #endif
diff --git a/source/io.c b/source/io.c
@@ -1,14 +1,5 @@
 #include "../include/io.h"
 
-#define INIT_SIZE        1000
-#define GROWTH_FACTOR     2
-
-status_t destroy_data(char **data);
-status_t get_date(time_t *e, char **data);
-
-void clean_buffer(char *buf);
-void clean_data(char **data);
-
 /* Lee los datos del archivo de entrada linea por linea mientras los procesa y asigna a un arreglo de usuarios */
 status_t process_file(cla_t cla, user_t **users, size_t *size)
 {
diff --git a/source/main.c b/source/main.c
@@ -1,6 +1,6 @@
 #include "../include/cla.h"
 #include "../include/status.h"
-#include "../include/io.h" /* output_gen() */
+#include "../include/io.h"
 #include "../include/sort.h"
 #include "../include/user.h"
 
@@ -57,6 +57,8 @@ int main (int argc, char *argv[])
         return st;
     }
 
+    /* Imprime un mensaje para darle a conocer al usuario
+     * que todo se ejecuto correctamente    */
     printf("\n%s\n%s%ld\n%s%ld\n", EXIT_SUCCESS_MSG, USERS_REGISTERED_MSG,\
             size, PROCESED_LINES_MSG, cla->parsed_lines);
 
diff --git a/test.sh b/test.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+printf ">>Formato de salida: csv\n"
+
+./main -fmt csv -out output.csv -in examples/test_file_20.csv -ti 1320498000 -tf 1320498046
+./main -fmt csv -out output.csv -in examples/test_file_2k.csv -ti 1320498000 -tf 1325499000
+./main -fmt csv -out output.csv -in examples/test_file_50.csv -ti 1320498000 -tf 1320498049
+./main -fmt csv -out output.csv -in examples/test_file_500.csv -ti 1320498000 -tf 1320529000
+./main -fmt csv -out output.csv -in examples/test_file_5k.csv -ti 1320498000 -tf 1320529000
+./main -fmt csv -out output.csv -in examples/test_file_50k.csv -ti 1320498000 -tf 1420529000
+./main -fmt csv -out output.csv -in examples/test_file_500k.csv -ti 1320498000 -tf 1420529000
+
+
+printf "\n>>Formato de salida: xml\n"
+./main -fmt xml -out output.xml -in examples/test_file_50.csv -ti 1320498000 -tf 1320498049
+./main -fmt xml -out output.xml -in examples/test_file_5k.csv -ti 1320498000 -tf 1360498049
+./main -fmt xml -out output.xml -in examples/test_file_5m.csv -ti 1320498000 -tf 1360498049
+./main -fmt xml -out output.xml -in -ti 1320498000 -tf 1360498049
+./main -out output.xml -fmt xml -in examples/test_file_5k.csv -ti 1320498000 -tf 1360498049
+./main -out output.xml -fmt xml -in examples/test_file_5k.csv -tf 132049000 -ti 10498049
+./main -fmt rar -out output.csv -in examples/test_file_5k.csv -ti 1320498000 -tf 1360498049
+./main -in examples/test_file_5k.csv -fmt xml -out output.xml -ti 1320498000 -tf 1360498049