From 093653d1e6b998f57850682e621f1a5832494ff8 Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Tue, 17 May 2022 13:19:27 +0800 Subject: [PATCH] Define call count type Use call count type to contextualize call counts. --- src/packages/game-test/config/IZ_config.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/packages/game-test/config/IZ_config.c b/src/packages/game-test/config/IZ_config.c index f74b888..cbf3fb7 100644 --- a/src/packages/game-test/config/IZ_config.c +++ b/src/packages/game-test/config/IZ_config.c @@ -1,13 +1,15 @@ #include "bdd-for-c.h" #include "../../game/config/IZ_config.h" -#define mock(X) static uint8_t calls_##X = 0; +#define mock_call_count_t uint8_t + +#define mock(X) static mock_call_count_t calls_##X = 0; #define mock_return(X) calls_##X += 1; return #define mock_reset(X) calls_##X = 0 -#define mock_calls(X) ((uint8_t) (calls_##X)) +#define mock_calls(X) ((mock_call_count_t) (calls_##X)) mock(SDL_GetBasePath) char* SDL_GetBasePath() { mock_return(SDL_GetBasePath) ""; @@ -73,7 +75,7 @@ spec("config") { "SDL_GetBasePath() not called." ); - static const int expected_calls_ini_getl = + static const mock_call_count_t expected_calls_ini_getl = 3 // video params + 1 // input params + (12 * PLAYERS); // joystick controls @@ -102,7 +104,7 @@ spec("config") { "Default value for Input.GamepadAxisThreshold is not loaded." ); - static const int expected_calls_ini_gets = + static const mock_call_count_t expected_calls_ini_gets = (16 * PLAYERS); // keyboard controls check( mock_calls(ini_gets) == expected_calls_ini_gets, @@ -111,7 +113,7 @@ spec("config") { mock_calls(ini_gets) ); - static const int expected_calls_SDL_GetKeyFromName = + static const mock_call_count_t expected_calls_SDL_GetKeyFromName = (16 * PLAYERS); // keyboard controls check( mock_calls(SDL_GetKeyFromName) == expected_calls_SDL_GetKeyFromName, @@ -120,7 +122,7 @@ spec("config") { mock_calls(SDL_GetKeyFromName) ); - static const int expected_calls_SDL_GetKeyName = + static const mock_call_count_t expected_calls_SDL_GetKeyName = (16 * PLAYERS); // keyboard controls check( mock_calls(SDL_GetKeyName) == expected_calls_SDL_GetKeyName,