2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.6 KiB

  1. #ifndef SDL_GAMECONTROLLER_MOCK_H
  2. #define SDL_GAMECONTROLLER_MOCK_H
  3. #include <bdd-for-c-mocks.h>
  4. #include <SDL_gamecontroller.h>
  5. #include <SDL_rwops.h>
  6. #include "../../../src/packages/common/IZ_common.h"
  7. #define MOCK_OPEN_JOYSTICKS 1
  8. mock(SDL_GameControllerOpen) SDL_GameController* SDL_GameControllerOpen(i32 device_index) {
  9. static void* joystick = (void*) 1;
  10. mock_return(SDL_GameControllerOpen) (SDL_GameController*) &joystick;
  11. }
  12. mock(SDL_NumJoysticks) i32 SDL_NumJoysticks(void) {
  13. mock_return(SDL_NumJoysticks) MOCK_OPEN_JOYSTICKS;
  14. }
  15. mock(SDL_JoystickInstanceID) i32 SDL_JoystickInstanceID(SDL_Joystick* joystick) {
  16. mock_return(SDL_JoystickInstanceID) 0;
  17. }
  18. mock(SDL_GameControllerClose) void SDL_GameControllerClose(SDL_GameController* _joystick) {
  19. mock_return(SDL_GameControllerClose);
  20. }
  21. mock(SDL_JoystickGetGUID) SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick* joystick) {
  22. mock_return(SDL_JoystickGetGUID) (SDL_JoystickGUID) {
  23. .data = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }
  24. };
  25. }
  26. mock(SDL_GameControllerAddMappingsFromRW) int SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, int freerw) {
  27. mock_return(SDL_GameControllerAddMappingsFromRW) 1;
  28. }
  29. mock(SDL_GameControllerFromInstanceID) SDL_GameController* SDL_GameControllerFromInstanceID(SDL_JoystickID instance_id) {
  30. static void* joystick = (void*) 1;
  31. mock_return(SDL_GameControllerFromInstanceID) (SDL_GameController*) &joystick;
  32. }
  33. mock(SDL_GameControllerGetJoystick) SDL_Joystick* SDL_GameControllerGetJoystick(SDL_GameController* gamecontroller) {
  34. static void* joystick = (void*) 1;
  35. mock_return(SDL_GameControllerGetJoystick) (SDL_Joystick*) &joystick;
  36. }
  37. #endif