Skip to content

Commit

Permalink
[#123] Fix FatFile unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidZemon committed Apr 29, 2017
1 parent f9e5c94 commit ac75e82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions test/PropWare/fatfilereader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ TEARDOWN {
}

TEST(ConstructorDestructor) {
testable = new FatFileReader(g_fs, FILE_NAME, buffer);
testable = new FatFileReader(g_fs, FILE_NAME);

// Ensure the requested filename was not all upper case (that wouldn't be a very good test if it were)
ASSERT_NEQ_MSG(0, strcmp(FILE_NAME, FILE_NAME_UPPER));

ASSERT_EQ_MSG(0, strcmp(FILE_NAME_UPPER, testable->get_name()));
ASSERT_EQ_MSG((unsigned int) &pwOut, (unsigned int) testable->m_logger);
ASSERT_EQ_MSG((unsigned int) g_fs.get_driver(), (unsigned int) testable->m_driver);
ASSERT_EQ_MSG((unsigned int) &buffer, (unsigned int) testable->m_buf);
ASSERT_NEQ_MSG((unsigned int) NULL, (unsigned int) testable->m_buf->buf);
ASSERT_EQ_MSG((unsigned int) &PropWare::SHARED_BUFFER, (unsigned int) testable->m_buf);
ASSERT_EQ_MSG((unsigned int) PropWare::SHARED_BUFFER.buf, (unsigned int) testable->m_buf->buf);
ASSERT_EQ_MSG((unsigned int) &g_fs.m_dirMeta, (unsigned int) testable->m_fsBufMeta);
ASSERT_EQ_MSG((unsigned int) &g_fs, (unsigned int) testable->m_fs);
ASSERT_EQ_MSG(-1, testable->get_length());
Expand All @@ -124,7 +124,7 @@ TEST(ConstructorDestructor) {
}

TEST(Exists_doesExist) {
testable = new FatFileReader(g_fs, FILE_NAME, buffer);
testable = new FatFileReader(g_fs, FILE_NAME);

PropWare::ErrorCode err;
const bool exists = testable->exists(err);
Expand All @@ -134,14 +134,14 @@ TEST(Exists_doesExist) {
}

TEST(Exists_doeesNotExist) {
testable = new FatFileReader(g_fs, BOGUS_FILE_NAME, buffer);
testable = new FatFileReader(g_fs, BOGUS_FILE_NAME);
ASSERT_FALSE(testable->exists());
tearDown();
}

TEST(OpenClose) {
PropWare::ErrorCode err;
testable = new FatFileReader(g_fs, FILE_NAME, buffer);
testable = new FatFileReader(g_fs, FILE_NAME);

err = testable->open();
error_checker(err);
Expand All @@ -159,7 +159,7 @@ TEST(OpenClose) {
}

TEST(Open_NonExistantFile) {
testable = new FatFileReader(g_fs, BOGUS_FILE_NAME, buffer);
testable = new FatFileReader(g_fs, BOGUS_FILE_NAME);
ASSERT_EQ_MSG(FatFile::FILENAME_NOT_FOUND, testable->open());

tearDown();
Expand Down
12 changes: 6 additions & 6 deletions test/PropWare/fatfilewriter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ TEST(ConstructorDestructor) {
// Ensure the requested filename was not all upper case (that wouldn't be a very good test if it were)
ASSERT_NEQ_MSG(0, strcmp(EXISTING_FILE, EXISTING_FILE_UPPER));

testable = new FatFileWriter(g_fs, EXISTING_FILE, buffer);
testable = new FatFileWriter(g_fs, EXISTING_FILE);

ASSERT_EQ_MSG(0, strcmp(EXISTING_FILE_UPPER, testable->get_name()));
ASSERT_EQ_MSG((unsigned int) &pwOut, (unsigned int) testable->m_logger);
ASSERT_EQ_MSG((unsigned int) g_fs.get_driver(), (unsigned int) testable->m_driver);
ASSERT_EQ_MSG((unsigned int) &buffer, (unsigned int) testable->m_buf);
ASSERT_EQ_MSG((unsigned int) &PropWare::SHARED_BUFFER, (unsigned int) testable->m_buf);
ASSERT_EQ_MSG((unsigned int) testable->m_fs, (unsigned int) &g_fs);
ASSERT_EQ_MSG(-1, testable->get_length());
ASSERT_EQ_MSG(false, testable->m_fileMetadataModified);
Expand All @@ -128,13 +128,13 @@ TEST(ConstructorDestructor) {
}

TEST(Exists_doesNotExist) {
testable = new FatFileWriter(g_fs, NEW_FILE_NAME, buffer);
testable = new FatFileWriter(g_fs, NEW_FILE_NAME);
ASSERT_FALSE(testable->exists());
tearDown();
}

TEST(Exists_doesExist) {
testable = new FatFileWriter(g_fs, EXISTING_FILE, buffer);
testable = new FatFileWriter(g_fs, EXISTING_FILE);

PropWare::ErrorCode err;
const bool exists = testable->exists(err);
Expand All @@ -146,7 +146,7 @@ TEST(Exists_doesExist) {
TEST(OpenClose_ExistingFile) {
PropWare::ErrorCode err;

testable = new FatFileWriter(g_fs, EXISTING_FILE, buffer);
testable = new FatFileWriter(g_fs, EXISTING_FILE);

err = testable->open();
error_checker(err);
Expand All @@ -164,7 +164,7 @@ TEST(OpenClose_ExistingFile) {
TEST(OpenCloseDelete_NonExistingFile) {
PropWare::ErrorCode err;

testable = new FatFileWriter(g_fs, NEW_FILE_NAME, buffer);
testable = new FatFileWriter(g_fs, NEW_FILE_NAME);

ASSERT_FALSE(testable->exists());

Expand Down

0 comments on commit ac75e82

Please sign in to comment.