Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. From 55b9f492515fae7ded1014c52f9b167fbbe3a8dc Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Tam=C3=A1s=20Feh=C3=A9rv=C3=A1ri?= <geever@users.sourceforge.net>
  3. Date: Sun, 7 Nov 2010 13:35:08 +0100
  4. Subject: [PATCH] * unittest for AIR_Foreach
  5.  
  6. ---
  7. src/tests/test_campaign.c | 34 ++++++++++++++++++++++++++++++++++
  8. 1 files changed, 34 insertions(+), 0 deletions(-)
  9.  
  10. diff --git a/src/tests/test_campaign.c b/src/tests/test_campaign.c
  11. index 459ae37..692fc5d 100644
  12. --- a/src/tests/test_campaign.c
  13. +++ b/src/tests/test_campaign.c
  14. @@ -164,6 +164,37 @@ static base_t* CreateBase (const char *name, const vec2_t pos)
  15. return base;
  16. }
  17.  
  18. +static void testAircraftHandling (void)
  19. +{
  20. + const vec2_t destination = { 10, 10 };
  21. + aircraft_t *aircraft;
  22. + base_t *base;
  23. + int cnt;
  24. + campaign_t *campaign;
  25. +
  26. + ResetCampaignData();
  27. +
  28. + campaign = GetCampaign();
  29. +
  30. + base = CreateBase("unittestaircraft", destination);
  31. + CU_ASSERT_PTR_NOT_NULL_FATAL(base);
  32. +
  33. + aircraft = AIR_GetNextFromBase(base, NULL);
  34. + CU_ASSERT_PTR_NOT_NULL_FATAL(aircraft);
  35. +
  36. + cnt = AIR_BaseCountAircraft(base);
  37. +
  38. + AIR_Foreach(aircraft) {
  39. + cnt--;
  40. + }
  41. + CU_ASSERT_EQUAL(cnt, 0);
  42. +
  43. + /* cleanup for the following tests */
  44. + E_DeleteAllEmployees(NULL);
  45. +
  46. + base->founded = qfalse;
  47. +}
  48. +
  49. static void testEmployeeHandling (void)
  50. {
  51. employeeType_t type;
  52. @@ -905,6 +936,9 @@ int UFO_AddCampaignTests (void)
  53. if (CU_ADD_TEST(campaignSuite, testBaseBuilding) == NULL)
  54. return CU_get_error();
  55.  
  56. + if (CU_ADD_TEST(campaignSuite, testAircraftHandling) == NULL)
  57. + return CU_get_error();
  58. +
  59. if (CU_ADD_TEST(campaignSuite, testEmployeeHandling) == NULL)
  60. return CU_get_error();
  61.  
  62. --
  63. 1.7.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement