Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Created SetUp and TearDown functions for testrwops suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed Aug 28, 2011
1 parent bfdebcc commit 151f617
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions test/test-automation/tests/testrwops/testrwops.c
Expand Up @@ -13,13 +13,13 @@

#include "../../include/SDL_test.h"

// TODO create these at SetUp() and such TearDown()
const char* RWOPS_READ = "tests/testrwops/read";
const char* RWOPS_WRITE = "tests/testrwops/write";
const char* RWOPS_READ = "rwops_read";
const char* RWOPS_WRITE = "rwops_write";

static const char hello_world[] = "Hello World!";
static const char const_mem[] = "Hello World!";


/* Test cases */
static const TestCaseReference test1 =
(TestCaseReference){ "rwops_testParam", "test parameters", TEST_ENABLED, 0, 0 };
Expand Down Expand Up @@ -54,6 +54,25 @@ TestCaseReference **QueryTestSuite() {
}


// Fixture
void
SetUp(void *arg)
{
FILE *handle = fopen(RWOPS_READ, "w");
AssertTrue(handle != NULL, "Creating file '%s' failed", RWOPS_READ);

fwrite(hello_world, 1, SDL_strlen(hello_world), handle);
fclose(handle);
}

void
TearDown(void *arg)
{
// Remove the created files
remove(RWOPS_READ);
remove(RWOPS_WRITE);
}

/**
* @brief Makes sure parameters work properly. Helper function
*
Expand Down

0 comments on commit 151f617

Please sign in to comment.