diff options
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | i_validation.h | 4 | ||||
-rw-r--r-- | test/testcases/i_validation_cases.txt | 21 | ||||
-rw-r--r-- | test/validate_check_imm.c | 28 | ||||
-rw-r--r-- | test/validate_check_p_m.c | 28 | ||||
-rw-r--r-- | test/validate_plus_continue_tests.c | 2 |
6 files changed, 84 insertions, 1 deletions
@@ -1,4 +1,4 @@ -TODO list. This is mostly so i remember small stuff i was working on last time and what i should prioritise first. +TODO list. This is mostly so i can plan more granularly and remember small stuff i was working on last time and what i should prioritise first. This is not my overall big planning board. (1 highest prio, 10 lowest) 1 - test validate_check_p_m diff --git a/i_validation.h b/i_validation.h index 3c01563..a1ee328 100644 --- a/i_validation.h +++ b/i_validation.h @@ -14,6 +14,10 @@ #define _CONTINUE 6 #define _NA 7 +int validate_check_p_m(char *smode_buf) + +int validate_check_imm(char *smode_buf); + int validate_plus_continue(char *smode_buf); int validate_L(char *smode_buf); diff --git a/test/testcases/i_validation_cases.txt b/test/testcases/i_validation_cases.txt new file mode 100644 index 0000000..81c8601 --- /dev/null +++ b/test/testcases/i_validation_cases.txt @@ -0,0 +1,21 @@ +validate_check_p_m +Positive input (Valid): +L+ +L+1 +L+2 +L+3 +L+9 +L+10 +L+90 +L+100 +L+900 + +Negative (Invalid): + +validate_check_imm +Positive input (Valid): +Negative (Invalid): + +validate_plus_continue +Positive input (Valid): +Negative (Invalid):
\ No newline at end of file diff --git a/test/validate_check_imm.c b/test/validate_check_imm.c new file mode 100644 index 0000000..a4d3132 --- /dev/null +++ b/test/validate_check_imm.c @@ -0,0 +1,28 @@ +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include "7ed.h" +#include "i_validation.h" +#include "input.h" +#include <stdint.h> + +// Test for validate_check_imm + +int main () { + uint64_t focus = 1; + char smode_buf[SMODE_MAX_SIZE]; // Smode buffer + fprintf(stdout, "(%lu): ", focus); // UI + fgets(smode_buf, SMODE_MAX_SIZE, stdin); // Read user input + + int ret = validate_check_imm(smode_buf); + + if(ret == _INVALID) { + printf("?\n"); + } + if(ret == _VALID) { + printf("valid\n"); + } + +}
\ No newline at end of file diff --git a/test/validate_check_p_m.c b/test/validate_check_p_m.c new file mode 100644 index 0000000..2af38df --- /dev/null +++ b/test/validate_check_p_m.c @@ -0,0 +1,28 @@ +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include "7ed.h" +#include "i_validation.h" +#include "input.h" +#include <stdint.h> + +// Test for validate_check_p_m + +int main () { + uint64_t focus = 1; + char smode_buf[SMODE_MAX_SIZE]; // Smode buffer + fprintf(stdout, "(%lu): ", focus); // UI + fgets(smode_buf, SMODE_MAX_SIZE, stdin); // Read user input + + int ret = validate_check_p_m(smode_buf); + + if(ret == _INVALID) { + printf("?\n"); + } + if(ret == _VALID) { + printf("valid\n"); + } + +}
\ No newline at end of file diff --git a/test/validate_plus_continue_tests.c b/test/validate_plus_continue_tests.c index 433dcac..67e687a 100644 --- a/test/validate_plus_continue_tests.c +++ b/test/validate_plus_continue_tests.c @@ -8,6 +8,8 @@ #include "input.h" #include <stdint.h> +// Test for validate_plus_continue + int main () { uint64_t focus = 1; char smode_buf[SMODE_MAX_SIZE]; // Smode buffer |