Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
63d368d
Drawing board - in progress
majkel-space Feb 21, 2019
2b1c1af
Bug fixing
majkel-space Feb 21, 2019
284c69e
Table formating corrected
majkel-space Feb 21, 2019
88ee114
Changed type for argument board_ from int to FieldsEnum.
OriaTori Feb 21, 2019
934a028
Drawing empty table
majkel-space Feb 21, 2019
2d9f180
Merge branch 'US2.2' of https://github.com/LordLukin/LogicalImages in…
majkel-space Feb 21, 2019
a3a7e04
Drawing board - bug fixed
majkel-space Feb 21, 2019
5223d1c
Drawing Board - bug fixed
majkel-space Feb 21, 2019
2e3b155
Bug fixed, one test added
majkel-space Feb 21, 2019
8525c42
Changed type for argument board_ from int to FieldsEnum.
OriaTori Feb 21, 2019
6784807
Changed drawBoard, one test added
majkel-space Feb 21, 2019
d438de2
Merge branch 'US2.2' of https://github.com/LordLukin/LogicalImages in…
majkel-space Feb 22, 2019
de0455b
Changed functions drawEmptyLine, drawBoard, drawEndlLine, drawPadding…
OriaTori Feb 22, 2019
6967eff
Added new files for displaying board and functions from the Board cla…
OriaTori Feb 22, 2019
b3f1fbb
Added functions to returns maximum number of element in row or column.
OriaTori Feb 23, 2019
b764fc6
Changed function drawBoard and its' test, added functions drwaColumns…
OriaTori Feb 23, 2019
86035bf
Helper functions from DisplayBoard encapsulated
gitmajo Feb 23, 2019
ec6c523
Merge branch 'US2.2' of https://github.com/LordLukin/LogicalImages in…
majkel-space Feb 23, 2019
e32a7b9
Print Board method added
gitmajo Feb 23, 2019
589e0ff
Merge branch 'US2.2' of https://github.com/LordLukin/LogicalImages in…
majkel-space Feb 23, 2019
71feaa9
Modified board drawing
majkel-space Feb 23, 2019
c40faa4
Overloaded ostream operator for Board added
gitmajo Feb 24, 2019
7bfbe69
Revert "Overloaded ostream operator for Board added"
gitmajo Feb 24, 2019
54bf45c
Overloaded ostream operator for Board added
gitmajo Feb 24, 2019
990c635
Changed type function drawBoard and displayed characters.
OriaTori Feb 24, 2019
0cdacfc
Changed namespace in DisplayBoard, function drawBoard has been moved
OriaTori Feb 25, 2019
a93af8a
Board: change ostringstream to stringstream in drawBoard
jzych Feb 25, 2019
a5fa58f
DisplayBoardTests: Fix includes and add drawBoard test
jzych Feb 25, 2019
d922640
DisplayBoardTests: Minor codsestyle fixes
jzych Feb 25, 2019
cbf537b
Board: Refactor getMaxNumbEleInRow/Col into findLongestVectorInRows/Cols
jzych Feb 25, 2019
1aac3cd
BoardTests: Fix typo
jzych Feb 25, 2019
9e2610f
DisplayBoardTests: Fix board object calling in test
jzych Feb 25, 2019
63cd9f6
friend problem
gitmajo Feb 25, 2019
2ef982a
JSONFileReader: Fix test files to invoke proper exceptions
jzych Feb 25, 2019
141a981
Ecpasulation improved
gitmajo Feb 25, 2019
2930712
Irrelevant file removed
gitmajo Feb 25, 2019
52e325d
Encapsulation improved - namespace added, small refactoring
gitmajo Feb 25, 2019
96011d7
Unit test for display() method added
gitmajo Feb 25, 2019
6fd09af
Changes suggested in review
gitmajo Feb 28, 2019
c870f16
Changed in the drawEndLine function and condition in the drawBoard fu…
OriaTori Feb 28, 2019
713d56f
Drawing board - in progress
majkel-space Feb 21, 2019
51921a9
Bug fixing
majkel-space Feb 21, 2019
a02a1c4
Table formating corrected
majkel-space Feb 21, 2019
4e35437
Changed type for argument board_ from int to FieldsEnum.
OriaTori Feb 21, 2019
5221332
Drawing empty table
majkel-space Feb 21, 2019
ea84f4a
Drawing board - bug fixed
majkel-space Feb 21, 2019
0e838be
Drawing Board - bug fixed
majkel-space Feb 21, 2019
9dc35d3
Bug fixed, one test added
majkel-space Feb 21, 2019
f8c1352
Changed functions drawEmptyLine, drawBoard, drawEndlLine, drawPadding…
OriaTori Feb 22, 2019
27a519b
Added new files for displaying board and functions from the Board cla…
OriaTori Feb 22, 2019
bce6363
Added functions to returns maximum number of element in row or column.
OriaTori Feb 23, 2019
ca53f02
Changed function drawBoard and its' test, added functions drwaColumns…
OriaTori Feb 23, 2019
1ed7696
Helper functions from DisplayBoard encapsulated
gitmajo Feb 23, 2019
94576a3
Print Board method added
gitmajo Feb 23, 2019
2ca0c3f
Modified board drawing
majkel-space Feb 23, 2019
9abe2f8
Overloaded ostream operator for Board added
gitmajo Feb 24, 2019
5f10c67
Revert "Overloaded ostream operator for Board added"
gitmajo Feb 24, 2019
d33dd34
Changed type function drawBoard and displayed characters.
OriaTori Feb 24, 2019
ffd20d3
Changed namespace in DisplayBoard, function drawBoard has been moved
OriaTori Feb 25, 2019
2bb11cf
Board: change ostringstream to stringstream in drawBoard
jzych Feb 25, 2019
1846fcc
DisplayBoardTests: Fix includes and add drawBoard test
jzych Feb 25, 2019
37ad3f3
DisplayBoardTests: Minor codsestyle fixes
jzych Feb 25, 2019
3a10053
Board: Refactor getMaxNumbEleInRow/Col into findLongestVectorInRows/Cols
jzych Feb 25, 2019
fe80092
BoardTests: Fix typo
jzych Feb 25, 2019
308edec
DisplayBoardTests: Fix board object calling in test
jzych Feb 25, 2019
c2da02a
JSONFileReader: Fix test files to invoke proper exceptions
jzych Feb 25, 2019
2b23e81
Encapsulation improved - namespace added, small refactoring
gitmajo Feb 25, 2019
0fd1a7c
Unit test for display() method added
gitmajo Feb 25, 2019
0bdbcba
Changes suggested in review
gitmajo Feb 28, 2019
a71d227
Changed in the drawEndLine function and condition in the drawBoard fu…
OriaTori Feb 28, 2019
d67fb76
Merge branch 'US2.2' of https://github.com/LordLukin/LogicalImages in…
jzych Mar 1, 2019
480f7a1
Board: Remove *.hpp.gch file
jzych Mar 1, 2019
0cd50ad
BoardTests: Simplify findLongestVectorInRow/Col tests
jzych Mar 1, 2019
4d6b078
DisplayBoard: Refactor drawBoard
jzych Mar 1, 2019
4333c3d
DisplayBoard: minor code style fixes
jzych Mar 1, 2019
6534635
Board: Refactor findLongestVectorInLines into getLongestLineLenght
jzych Mar 1, 2019
3e638c5
DisplayBoard: minor codestyle fixes
jzych Mar 1, 2019
c1849d1
DisplayBoardTests: Remove private functions tests
jzych Mar 1, 2019
3ca9072
BoardTests: Convert vectors into Line/Lines in tests
jzych Mar 1, 2019
a777ef7
Merge branch 'master' into US2.2
jzych Mar 1, 2019
c9d11a7
Minnor corrections
gitmajo Mar 1, 2019
2944fa9
Code coverage improved
gitmajo Mar 1, 2019
3b00306
Conflists from branch US2.2 resolved. Ostream operator added.
gitmajo Mar 1, 2019
0eb690b
Conflicts from master resolved
gitmajo Mar 2, 2019
582d8f1
Declaration moved to Board.hpp
gitmajo Mar 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ class Board

void display() const;
};

std::ostream& operator<<(std::ostream& os, const Board& b);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it outside of the Board class? I think that task clearly describes that: Overloaded ostream operator for Board - which in my opinion mean that this should be in the class definition.

5 changes: 5 additions & 0 deletions src/DisplayBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,8 @@ std::string drawRow(const unsigned int maxElementsInRows)
return rows;
}
}

std::ostream& operator<<(std::ostream& os, const Board& b)
{
return os << DisplayBoard::display(b);
}
12 changes: 12 additions & 0 deletions test/DisplayBoardTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,15 @@ TEST_F(DisplayBoardTests, checkDisplayBoard)

ASSERT_EQ(output, compareBoard);
}

TEST_F(DisplayBoardTests, checkOverloadedOstreamOperator)
{
Board board(1, 1, {{1}}, {{1}});
std::string compareBoard = " +--+\n | |\n+--+--+\n| |??|\n+--+--+\n";

testing::internal::CaptureStdout();
std::cout << board;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unable to reproduce this feature in main.cpp by simple writing down code as below:

#include "Board.hpp"
...
    Board board(1, 1, {{1}}, {{1}});
    std::cout << board;

I got error:
error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘Board’)

Could you look into it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I moved declaration to board.hpp, but I still prefer to keep definition in DisplayBoard.cpp

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What use is to keep it in Displayboard when you can't use it?

Copy link
Copy Markdown
Collaborator Author

@gitmajo gitmajo Mar 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention was to keep definition and declaration in displayBoard.hpp / .cpp because it is completely connected to display functionality. I know that you prefer to include only in main board.hpp, so I moved definition of ostream operator to board.hpp.
From on site it would be clear to have declaration and definition in corresponding files (name.cpp & name.hpp).
On the other hand why not to "hide" definition it in DisplayBoard.cpp and do not "litter" Board.cpp.
@LordLukin what is your opinion?

std::string output = testing::internal::GetCapturedStdout();

ASSERT_EQ(output, compareBoard);
}