From 49fd41f5e17aa5609ddca3f514ed6405cec3b06e Mon Sep 17 00:00:00 2001 From: Joe Ranweiler Date: Wed, 21 Feb 2018 19:28:28 -0800 Subject: [PATCH] Return `bool` from `DeepState_Catch...` functions --- src/include/deepstate/DeepState.h | 8 ++++---- src/lib/DeepState.c | 20 ++++++-------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/include/deepstate/DeepState.h b/src/include/deepstate/DeepState.h index fdf804f..893e757 100644 --- a/src/include/deepstate/DeepState.h +++ b/src/include/deepstate/DeepState.h @@ -358,11 +358,11 @@ extern void DeepState_Begin(struct DeepState_TestInfo *info); /* Return the first test case to run. */ extern struct DeepState_TestInfo *DeepState_FirstTest(void); -/* Returns 1 if a failure was caught, otherwise 0. */ -extern int DeepState_CatchFail(void); +/* Returns `true` if a failure was caught for the current test case. */ +extern bool DeepState_CatchFail(void); -/* Returns 1 if this test case was abandoned. */ -extern int DeepState_CatchAbandoned(void); +/* Returns `true` if the current test case was abandoned. */ +extern bool DeepState_CatchAbandoned(void); /* Save a passing test to the output test directory. */ extern void DeepState_SavePassingTest(void); diff --git a/src/lib/DeepState.c b/src/lib/DeepState.c index 493670b..b20736c 100644 --- a/src/lib/DeepState.c +++ b/src/lib/DeepState.c @@ -528,22 +528,14 @@ struct DeepState_TestInfo *DeepState_FirstTest(void) { return DeepState_LastTestInfo; } -/* Returns 1 if a failure was caught, otherwise 0. */ -int DeepState_CatchFail(void) { - if (DeepState_CurrentTestRun->result == DeepState_TestRunFail) { - return 1; - } else { - return 0; - } +/* Returns `true` if a failure was caught for the current test case. */ +bool DeepState_CatchFail(void) { + return DeepState_CurrentTestRun->result == DeepState_TestRunFail; } -/* Returns 1 if this test case was abandoned. */ -int DeepState_CatchAbandoned(void) { - if (DeepState_CurrentTestRun->result == DeepState_TestRunAbandon) { - return 1; - } else { - return 0; - } +/* Returns `true` if the current test case was abandoned. */ +bool DeepState_CatchAbandoned(void) { + return DeepState_CurrentTestRun->result == DeepState_TestRunAbandon; } /* Overwrite libc's abort. */