move cout string to print function
parent
c087dd336b
commit
45244d3ffd
|
|
@ -130,8 +130,6 @@ namespace gtsam {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
ostream& operator<<(ostream& os, const VectorValues& v) {
|
ostream& operator<<(ostream& os, const VectorValues& v) {
|
||||||
os << "VectorValues"
|
|
||||||
<< ": " << v.size() << " elements\n";
|
|
||||||
// Change print depending on whether we are using TBB
|
// Change print depending on whether we are using TBB
|
||||||
#ifdef GTSAM_USE_TBB
|
#ifdef GTSAM_USE_TBB
|
||||||
map<Key, Vector> sorted;
|
map<Key, Vector> sorted;
|
||||||
|
|
@ -152,6 +150,7 @@ namespace gtsam {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void VectorValues::print(const string& str,
|
void VectorValues::print(const string& str,
|
||||||
const KeyFormatter& formatter) const {
|
const KeyFormatter& formatter) const {
|
||||||
|
cout << str << ": " << size() << " elements\n";
|
||||||
cout << *this;
|
cout << *this;
|
||||||
cout.flush();
|
cout.flush();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -239,9 +239,10 @@ TEST(VectorValues, print)
|
||||||
vv.insert(2, Vector2(4, 5));
|
vv.insert(2, Vector2(4, 5));
|
||||||
vv.insert(5, Vector2(6, 7));
|
vv.insert(5, Vector2(6, 7));
|
||||||
vv.insert(7, Vector2(8, 9));
|
vv.insert(7, Vector2(8, 9));
|
||||||
|
vv.print();
|
||||||
|
|
||||||
string expected =
|
string expected =
|
||||||
"VectorValues: 5 elements\n 0: 1\n 1: 2 3\n 2: 4 5\n 5: 6 7\n 7: 8 9\n";
|
" 0: 1\n 1: 2 3\n 2: 4 5\n 5: 6 7\n 7: 8 9\n";
|
||||||
stringstream actual;
|
stringstream actual;
|
||||||
actual << vv;
|
actual << vv;
|
||||||
EXPECT(expected == actual.str());
|
EXPECT(expected == actual.str());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue