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.
 
 
 
 
 
 

59 lines
1.3 KiB

  1. #include "../../../__mocks__/minIni.mock.h"
  2. #include "../../../__mocks__/SDL_stdinc.mock.h"
  3. #include "../../../__mocks__/SDL_render.mock.h"
  4. #include "video/IZ_video.h"
  5. const char* IZ_ConfigGetCommandlineOption(u8 argc, const char* argv[], const char* val) {
  6. size_t n = strlen(val);
  7. int c = argc;
  8. while (--c > 0) {
  9. if (!strncmp(argv[c], val, n)) {
  10. if (!*(argv[c] + n) && c < argc - 1) {
  11. /* coverity treats unchecked argv as "tainted" */
  12. if (!argv[c + 1] || strlen(argv[c + 1]) > 1024)
  13. return NULL;
  14. return argv[c + 1];
  15. }
  16. if (argv[c][n] == '=')
  17. return &argv[c][n + 1];
  18. return argv[c] + n;
  19. }
  20. }
  21. return NULL;
  22. }
  23. spec("output") {
  24. describe("video") {
  25. describe("SaveConfig") {
  26. static IZ_VideoState state;
  27. after_each() {
  28. mock_reset(ini_putl);
  29. }
  30. before_each() {
  31. state.config.width = 1337;
  32. state.config.height = 420;
  33. state.config.max_fps = 69;
  34. }
  35. it("calls save method") {
  36. mock_set_expected_calls(ini_putl, 3);
  37. IZ_VideoSaveConfig(&state, "config-game.ini");
  38. check(
  39. mock_get_expected_calls(ini_putl) == mock_get_actual_calls(ini_putl),
  40. "Call count mismatch for ini_putl() (expected %u, received %u).",
  41. mock_get_expected_calls(ini_putl),
  42. mock_get_actual_calls(ini_putl)
  43. );
  44. }
  45. }
  46. }
  47. }