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.
 
 
 
 
 
 

60 lines
1.4 KiB

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