diff options
author | Markus Kauppila <markus.kauppila@gmail.com> | 2011-08-28 11:55:54 +0300 |
---|---|---|
committer | Markus Kauppila <markus.kauppila@gmail.com> | 2011-08-28 11:55:54 +0300 |
commit | e91a0ea3f7bff5ab0a63082334a1a2048921955f (patch) | |
tree | d3be6d935cff807c61cea98b7bd5b7a49aa53f60 /test/test-automation | |
parent | d733d34ab899671383d18148276dfa842142b3ba (diff) |
Created SetUp and TearDown functions for testrwops suite.
Diffstat (limited to 'test/test-automation')
-rw-r--r-- | test/test-automation/tests/testrwops/testrwops.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/test/test-automation/tests/testrwops/testrwops.c b/test/test-automation/tests/testrwops/testrwops.c index 9c0ff764..4c295e5f 100644 --- a/test/test-automation/tests/testrwops/testrwops.c +++ b/test/test-automation/tests/testrwops/testrwops.c @@ -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 }; @@ -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 * |