summaryrefslogtreecommitdiff
path: root/src/include/aplwc.h
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-09-26 18:00:37 +0000
committerpeter <peter@pmikkelsen.com>2026-09-26 18:00:37 +0000
commit1b9a3117c6d37ca9e31629a9f7014860ffb23d8c (patch)
tree85b65ae0dd53d51a1b65aad377a74abce30d475d /src/include/aplwc.h
parent405509a7db6a2c7da227a9a75f222e7d9b32f6b0 (diff)
Improve the failure simulation test/code.
Right now, a lot of test cases fail because if this. Next up: fixing them :) FossilOrigin-Name: 6dd2985bcae86ed3f7c5651e2ce7bc848b80516bf4c1d5482b6095c18dfcc058
Diffstat (limited to 'src/include/aplwc.h')
-rw-r--r--src/include/aplwc.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/include/aplwc.h b/src/include/aplwc.h
index 5a6cb79..09507a1 100644
--- a/src/include/aplwc.h
+++ b/src/include/aplwc.h
@@ -29,6 +29,7 @@ enum aplwc_rc {
APLWC_NOT_YET_IMPLEMENTED,
APLWC_INVALID_UTF8,
APLWC_INVALID_SYNTAX,
+ APLWC_OTHER_FAILURE,
APLWC_RC_LAST = APLWC_INVALID_SYNTAX
};
@@ -44,14 +45,21 @@ struct aplwc_ref {
typedef struct { struct aplwc_ref ref; } AplwcLine;
typedef struct { struct aplwc_ref ref; } AplwcValue;
+enum aplwc_failsim_parameter {
+ APLWC_FAILSIM_START,
+ APLWC_FAILSIM_COUNT,
+ APLWC_FAILSIM_HITS,
+ APLWC_FAILSIM_FAILS,
+
+ APLWC_FAILSIM_PARAMETER_COUNT /* Not a real parameter, just the count */
+};
+
struct aplwc_fns {
void *(*alloc)(size_t, size_t *);
void (*dealloc)(void *);
+ unsigned long (*setup_failsim)(enum aplwc_failsim_parameter, unsigned long);
};
-extern uint64_t aplwc_simulate_failure_at;
-extern uint64_t aplwc_simulate_failure_count;
-
struct aplwc *aplwc_new(struct aplwc_fns, enum aplwc_rc *);
void aplwc_destroy(struct aplwc *);
void aplwc_clear_line(AplwcLine *);
@@ -67,6 +75,7 @@ void aplwc_eval(AplwcLine *, AplwcValue *);
void aplwc_free_value(AplwcValue *);
const char *aplwc_value_string(AplwcValue *);
enum aplwc_rc aplwc_load_module(struct aplwc *, const char *, const char *, int n);
+unsigned long aplwc_failsim_query(enum aplwc_failsim_parameter);
int aplwc_simulate_failure(void);
#endif /* APLWC_H */