From bb5abea645a31832e9d6a94cea09714a9b1632e3 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 19 Nov 2023 11:55:23 +0100 Subject: Fixed bug in tests with different architectures --- configure.sh | 8 ++++---- test/020_io_H48_read_write/io_H48_tests.c | 8 +++++--- test/021_io_SRC_write/io_SRC_tests.c | 8 +++++--- test/023_io_LST_write/io_LST_tests.c | 8 +++++--- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/configure.sh b/configure.sh index e4a142d..fdebf27 100755 --- a/configure.sh +++ b/configure.sh @@ -7,12 +7,9 @@ detectsan() { cc -fsanitize=$1 -dM -E -x c - config.mk diff --git a/test/020_io_H48_read_write/io_H48_tests.c b/test/020_io_H48_read_write/io_H48_tests.c index fafd396..705356c 100644 --- a/test/020_io_H48_read_write/io_H48_tests.c +++ b/test/020_io_H48_read_write/io_H48_tests.c @@ -1,11 +1,13 @@ #include "../test.h" int main(void) { - char *c, str[STRLENMAX]; + char str[STRLENMAX], *aux; cube_t cube; - for (c = str; (*c = getchar()) != EOF; c++) ; - *c = '\0'; + aux = str; + while (fgets(aux, STRLENMAX, stdin) != NULL) + while (*aux != '\n') + aux++; cube = readcube("H48", str); diff --git a/test/021_io_SRC_write/io_SRC_tests.c b/test/021_io_SRC_write/io_SRC_tests.c index ca33d1e..c427c6c 100644 --- a/test/021_io_SRC_write/io_SRC_tests.c +++ b/test/021_io_SRC_write/io_SRC_tests.c @@ -1,11 +1,13 @@ #include "../test.h" int main(void) { - char *c, str[STRLENMAX]; + char str[STRLENMAX], *aux; cube_t cube; - for (c = str; (*c = getchar()) != EOF; c++) ; - *c = '\0'; + aux = str; + while (fgets(aux, STRLENMAX, stdin) != NULL) + while (*aux != '\n') + aux++; cube = readcube("H48", str); diff --git a/test/023_io_LST_write/io_LST_tests.c b/test/023_io_LST_write/io_LST_tests.c index 3f42d7a..45cc203 100644 --- a/test/023_io_LST_write/io_LST_tests.c +++ b/test/023_io_LST_write/io_LST_tests.c @@ -8,11 +8,13 @@ cube_t readcube(char *, char *); void writecube(char *, cube_t, char *); int main(void) { - char *c, str[STRLENMAX]; + char str[STRLENMAX], *aux; cube_t cube; - for (c = str; (*c = getchar()) != EOF; c++) ; - *c = '\0'; + aux = str; + while (fgets(aux, STRLENMAX, stdin) != NULL) + while (*aux != '\n') + aux++; cube = readcube("H48", str); -- cgit v1.3