adding const to variable to comply with google code convention...

may need to change more stuff though. Taint what else do you mean? Spaces, tabs, names?
This commit is contained in:
nachocano 2014-11-27 17:03:31 -08:00
parent 2f1ba40786
commit 21f3f3eec4
5 changed files with 8 additions and 17 deletions

View File

@ -47,7 +47,7 @@ void Finalize(void) {
engine::Finalize(); engine::Finalize();
} }
#ifdef TEST #ifdef TEST
void SetMock(test::Mock& mock) { void SetMock(const test::Mock& mock) {
engine::SetMock(mock); engine::SetMock(mock);
} }
#endif #endif

View File

@ -82,7 +82,7 @@ void Finalize(void);
IEngine *GetEngine(void); IEngine *GetEngine(void);
#ifdef TEST #ifdef TEST
void SetMock(test::Mock& mock); void SetMock(const test::Mock& mock);
#endif #endif
} // namespace engine } // namespace engine

View File

@ -42,7 +42,7 @@ class SyncManager : public IEngine {
} }
#ifdef TEST #ifdef TEST
inline void SetMock(test::Mock& mock) { inline void SetMock(const test::Mock& mock) {
this->mock = mock; this->mock = mock;
} }
#endif #endif
@ -501,7 +501,7 @@ void Init(int argc, char *argv[]) {
#ifdef TEST #ifdef TEST
/*! \brief sets a mock to the manager for testing purposes */ /*! \brief sets a mock to the manager for testing purposes */
void SetMock(test::Mock& mock) { void SetMock(const test::Mock& mock) {
manager.SetMock(mock); manager.SetMock(mock);
} }
#endif #endif

View File

@ -34,4 +34,4 @@ $(MPIBIN) :
$(MPICXX) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) $(MPICXX) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.cpp %.o %.c, $^)
clean: clean:
$(RM) $(BIN) $(MPIBIN) *~ ../src/*~ $(RM) $(OBJ) $(BIN) $(MPIBIN) *~ ../src/*~

View File

@ -62,8 +62,8 @@ inline void TestBcast(size_t n, int root) {
utils::Check(res == s, "[%d] TestBcast fail", rank); utils::Check(res == s, "[%d] TestBcast fail", rank);
} }
// ugly stuff, just to see if it works // ugly stuff, just to see if it works. To be removed
inline void record(test::Mock& mock, int rank) { inline void Record(test::Mock& mock, const int rank) {
switch(rank) { switch(rank) {
case 0: case 0:
mock.OnAllReduce(0, false); mock.OnAllReduce(0, false);
@ -77,12 +77,6 @@ inline void record(test::Mock& mock, int rank) {
} }
} }
// to be removed, should be added in engine tcp
inline void replay(test::Mock& mock, int rank) {
printf("[%d] All reduce %d\n", rank, mock.AllReduce(rank));
printf("[%d] All reduce %d\n", rank, mock.AllReduce(rank));
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc < 2) { if (argc < 2) {
printf("Usage: <ndata>\n"); printf("Usage: <ndata>\n");
@ -95,14 +89,11 @@ int main(int argc, char *argv[]) {
#ifdef TEST #ifdef TEST
test::Mock mock; test::Mock mock;
record(mock, rank); Record(mock, rank);
mock.Replay(); mock.Replay();
//replay(mock, rank);
sync::SetMock(mock); sync::SetMock(mock);
#endif #endif
printf("[%d] start at %s\n", rank, name.c_str()); printf("[%d] start at %s\n", rank, name.c_str());
TestMax(n); TestMax(n);
printf("[%d] TestMax pass\n", rank); printf("[%d] TestMax pass\n", rank);