Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 55b9f492515fae7ded1014c52f9b167fbbe3a8dc Mon Sep 17 00:00:00 2001
- From: =?UTF-8?q?Tam=C3=A1s=20Feh=C3=A9rv=C3=A1ri?= <geever@users.sourceforge.net>
- Date: Sun, 7 Nov 2010 13:35:08 +0100
- Subject: [PATCH] * unittest for AIR_Foreach
- ---
- src/tests/test_campaign.c | 34 ++++++++++++++++++++++++++++++++++
- 1 files changed, 34 insertions(+), 0 deletions(-)
- diff --git a/src/tests/test_campaign.c b/src/tests/test_campaign.c
- index 459ae37..692fc5d 100644
- --- a/src/tests/test_campaign.c
- +++ b/src/tests/test_campaign.c
- @@ -164,6 +164,37 @@ static base_t* CreateBase (const char *name, const vec2_t pos)
- return base;
- }
- +static void testAircraftHandling (void)
- +{
- + const vec2_t destination = { 10, 10 };
- + aircraft_t *aircraft;
- + base_t *base;
- + int cnt;
- + campaign_t *campaign;
- +
- + ResetCampaignData();
- +
- + campaign = GetCampaign();
- +
- + base = CreateBase("unittestaircraft", destination);
- + CU_ASSERT_PTR_NOT_NULL_FATAL(base);
- +
- + aircraft = AIR_GetNextFromBase(base, NULL);
- + CU_ASSERT_PTR_NOT_NULL_FATAL(aircraft);
- +
- + cnt = AIR_BaseCountAircraft(base);
- +
- + AIR_Foreach(aircraft) {
- + cnt--;
- + }
- + CU_ASSERT_EQUAL(cnt, 0);
- +
- + /* cleanup for the following tests */
- + E_DeleteAllEmployees(NULL);
- +
- + base->founded = qfalse;
- +}
- +
- static void testEmployeeHandling (void)
- {
- employeeType_t type;
- @@ -905,6 +936,9 @@ int UFO_AddCampaignTests (void)
- if (CU_ADD_TEST(campaignSuite, testBaseBuilding) == NULL)
- return CU_get_error();
- + if (CU_ADD_TEST(campaignSuite, testAircraftHandling) == NULL)
- + return CU_get_error();
- +
- if (CU_ADD_TEST(campaignSuite, testEmployeeHandling) == NULL)
- return CU_get_error();
- --
- 1.7.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement