From 1095a92c6154d4cd5519a718beb863db7db39cdc Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Thu, 2 Jun 2022 19:10:52 +0800 Subject: [PATCH] Update mock int types Use consistent integer types for mocks. --- __mocks__/SDL_joystick.mock.h | 7 ++++--- __mocks__/SDL_keyboard.mock.h | 5 +++-- __mocks__/SDL_render.mock.h | 17 +++++++++-------- __mocks__/SDL_stdinc.mock.h | 2 +- __mocks__/minIni.mock.h | 21 +++++++++++---------- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/__mocks__/SDL_joystick.mock.h b/__mocks__/SDL_joystick.mock.h index 821b805..e374ded 100644 --- a/__mocks__/SDL_joystick.mock.h +++ b/__mocks__/SDL_joystick.mock.h @@ -1,20 +1,21 @@ #ifndef SDL_JOYSTICK_MOCK_H #define SDL_JOYSTICK_MOCK_H +#include "../src/packages/game/IZ_common.h" #include "../src/packages/test/IZ_test.h" typedef struct _SDL_Joystick {} SDL_Joystick; -mock(SDL_JoystickOpen) SDL_Joystick* SDL_JoystickOpen(int device_index) { +mock(SDL_JoystickOpen) SDL_Joystick* SDL_JoystickOpen(i32 device_index) { static SDL_Joystick joystick; mock_return(SDL_JoystickOpen) &joystick; } -mock(SDL_NumJoysticks) int SDL_NumJoysticks(void) { +mock(SDL_NumJoysticks) i32 SDL_NumJoysticks(void) { mock_return(SDL_NumJoysticks) 1; } -mock(SDL_JoystickInstanceID) int SDL_JoystickInstanceID(SDL_Joystick* joystick) { +mock(SDL_JoystickInstanceID) i32 SDL_JoystickInstanceID(SDL_Joystick* joystick) { mock_return(SDL_JoystickInstanceID) 0; } diff --git a/__mocks__/SDL_keyboard.mock.h b/__mocks__/SDL_keyboard.mock.h index 71ebcb3..2282e45 100644 --- a/__mocks__/SDL_keyboard.mock.h +++ b/__mocks__/SDL_keyboard.mock.h @@ -1,13 +1,14 @@ #ifndef SDL_KEYBOARD_MOCK_H #define SDL_KEYBOARD_MOCK_H +#include "../src/packages/game/IZ_common.h" #include "../src/packages/test/IZ_test.h" -mock(SDL_GetKeyName) const char* SDL_GetKeyName(int key) { +mock(SDL_GetKeyName) const char* SDL_GetKeyName(i32 key) { mock_return(SDL_GetKeyName) ""; } -mock(SDL_GetKeyFromName) int SDL_GetKeyFromName(const char *name) { +mock(SDL_GetKeyFromName) i32 SDL_GetKeyFromName(const char *name) { mock_return(SDL_GetKeyFromName) 0; } diff --git a/__mocks__/SDL_render.mock.h b/__mocks__/SDL_render.mock.h index fb75883..a9278a6 100644 --- a/__mocks__/SDL_render.mock.h +++ b/__mocks__/SDL_render.mock.h @@ -1,6 +1,7 @@ #ifndef SDL_RENDER_MOCK_H #define SDL_RENDER_MOCK_H +#include "../src/packages/game/IZ_common.h" #include "../src/packages/test/IZ_test.h" typedef struct SDL_Renderer SDL_Renderer; @@ -11,34 +12,34 @@ typedef struct SDL_FRect SDL_FRect; mock(SDL_CreateWindow) SDL_Window* SDL_CreateWindow( const char *title, - int x, int y, int w, - int h, unsigned int flags + i32 x, i32 y, i32 w, + i32 h, u32 flags ) { static SDL_Window* window = (SDL_Window*) 1; mock_return(SDL_CreateWindow) window; } -mock(SDL_CreateRenderer) SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, int index, unsigned int flags) { +mock(SDL_CreateRenderer) SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, i32 index, u32 flags) { static SDL_Renderer* renderer = (SDL_Renderer*) 1; mock_return(SDL_CreateRenderer) renderer; } -mock(SDL_SetRenderDrawColor) int SDL_SetRenderDrawColor( +mock(SDL_SetRenderDrawColor) i32 SDL_SetRenderDrawColor( SDL_Renderer* renderer, - unsigned char r, unsigned char g, unsigned char b, - unsigned char a + u8 r, u8 g, u8 b, + u8 a ) { mock_return(SDL_SetRenderDrawColor) 0; } -mock(SDL_RenderFillRectF) int SDL_RenderFillRectF( +mock(SDL_RenderFillRectF) i32 SDL_RenderFillRectF( SDL_Renderer* renderer, const SDL_FRect* rect ) { mock_return(SDL_RenderFillRectF) 0; } -mock(SDL_RenderClear) int SDL_RenderClear(SDL_Renderer* renderer) { +mock(SDL_RenderClear) i32 SDL_RenderClear(SDL_Renderer* renderer) { mock_return(SDL_RenderClear) 0; } diff --git a/__mocks__/SDL_stdinc.mock.h b/__mocks__/SDL_stdinc.mock.h index 37178e3..8e8b099 100644 --- a/__mocks__/SDL_stdinc.mock.h +++ b/__mocks__/SDL_stdinc.mock.h @@ -1,8 +1,8 @@ #ifndef SDL_STDINC_MOCK_H #define SDL_STDINC_MOCK_H -#include "../src/packages/test/IZ_test.h" #include +#include "../src/packages/test/IZ_test.h" mock(SDL_memcpy) void* SDL_memcpy(void* dst, const void* src, size_t len) { mock_return(SDL_memcpy) memcpy(dst, src, len); diff --git a/__mocks__/minIni.mock.h b/__mocks__/minIni.mock.h index 9191a7d..a9b5cfc 100644 --- a/__mocks__/minIni.mock.h +++ b/__mocks__/minIni.mock.h @@ -1,28 +1,29 @@ #ifndef MININI_MOCK_H #define MININI_MOCK_H +#include "../src/packages/game/IZ_common.h" #include "../src/packages/test/IZ_test.h" -mock(ini_getl) long ini_getl(const TCHAR *Section, const TCHAR *Key, long DefValue, const TCHAR *Filename) { +mock(ini_getl) long ini_getl(const char *Section, const char *Key, long DefValue, const char *Filename) { mock_return(ini_getl) DefValue; } -mock(ini_putl) int ini_putl(const TCHAR *Section, const TCHAR *Key, long Value, const TCHAR *Filename) { +mock(ini_putl) i32 ini_putl(const char *Section, const char *Key, long Value, const char *Filename) { mock_return(ini_putl) 1; } -mock(ini_gets) int ini_gets( - const TCHAR *Section, - const TCHAR *Key, - const TCHAR *DefValue, - TCHAR *Buffer, - int BufferSize, - const TCHAR *Filename +mock(ini_gets) i32 ini_gets( + const char *Section, + const char *Key, + const char *DefValue, + char *Buffer, + i32 BufferSize, + const char *Filename ) { mock_return(ini_gets) 0; } -mock(ini_puts) int ini_puts(const TCHAR *Section, const TCHAR *Key, const TCHAR *Value, const TCHAR *Filename) { +mock(ini_puts) i32 ini_puts(const char *Section, const char *Key, const char *Value, const char *Filename) { mock_return(ini_puts) 1; }