Skip to content

Commit

Permalink
Setting up for use of a filereader-mock, and some minor temporary adj…
Browse files Browse the repository at this point in the history
…ustments to fix failing tests.
  • Loading branch information
jaju committed Apr 6, 2011
1 parent d427d05 commit fb231dc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
12 changes: 12 additions & 0 deletions test/FileReaderMock.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <FileReader.hpp>

class FileReaderMock : public FileReader {
public:
FileReaderMock(std::string filepath):FileReader(filepath) {}
~FileReaderMock() {}

public:
MOCK_METHOD0(getLine, std::string());
MOCK_METHOD0(isGood, bool());
};

4 changes: 2 additions & 2 deletions test/FileRecordsWriterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ TEST(FileRecordsWriter, fileProvidedIsNotValid) {

TEST(FileRecordsWriter, fileProvidedIsValid) {

EXPECT_NO_THROW({FileRecordsWriter recordWriter = FileRecordsWriter(string("MakeFile"));});
EXPECT_NO_THROW({FileRecordsWriter recordWriter = FileRecordsWriter(string("Makefile"));});
//delete recordWriter;
};

TEST(FileRecordsWriter, dataWrittenToFile4line) {

FileRecordsWriter recordWriter = FileRecordsWriter(string("testData/test.txt"));
FileRecordsWriter recordWriter = FileRecordsWriter(string("../testData/test.txt"));
vector<string> str1;
str1.push_back("callId1");
str1.push_back("phone");
Expand Down
11 changes: 1 addition & 10 deletions test/RatePlanLookupTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <RatePlanLookup.h>
#include <FileReader.hpp>
#include "FileReaderMock.hpp"

using ::testing::Return;
using ::testing::Expectation;
using ::testing::Exactly;
using ::testing::InSequence;

class FileReaderMock : public FileReader {
public:
FileReaderMock(std::string filepath):FileReader(filepath) {}
~FileReaderMock() {}

public:
MOCK_METHOD0(getLine, std::string());
MOCK_METHOD0(isGood, bool());
};

TEST(RatePlanLookup, ReadsDataFromFile) {
FileReaderMock fileReader("dummydata.txt");
Expand Down
4 changes: 4 additions & 0 deletions testData/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
callId1,phone,time,duration
callId2,phone,time,duration
callId3,phone,time,duration
callId4,phone,time,duration

0 comments on commit fb231dc

Please sign in to comment.