This page has been replaced with BoostTest? files in the boost sandbox. This page is no longer being updated.
- Jared
This page is an attempt to show default usage with a selection of built-in and standard library types to get an idea of what our default output should be. Once these have been hashed out, they should be put into test cases, and this page can go away.
int i = 123; print(i); output: 123
float f = 1.234f; print(f); output: 1.234
string s = "some string"; print(s); output: some string
bool b = true; print(b); output: true
b = false; print(b); output: false
pair<int,int> pi = make_pair(1,2); print(pi); output: [1, 2]
vector<int> vi; print(vi); output: []
vi.push_back(1); print(vi); output: [1]
vi.push_back(2); vi.push_back(3); print(vi); output: [1, 2, 3]
vector<vector<int> > vvi; print(vvi); output: []
vvi.push_back(vi); print(vvi); output: [[1, 2, 3]]
vvi.push_back(vi); vvi.push_back(vi); print(vvi); output: [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
vector<string> vs; vs.push_back("[1, 2, 3], [1, 2, 3], [1, 2, 3]"); print(vs); output: [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
vector<pair<int,int> > vpi; print(vpi); output: []
pair<int,int> pi = make_pair(1,2);
vpi.push_back(pi); print(vpi); output: [[1, 2]]
vvi.push_back(pi); vvi.push_back(pi); print(vpi); output: [[1, 2], [1, 2], [1, 2]]
map<int,string> mis; print(mis); output: []
mis.insert(make_pair(1, "first")); print(mis); output: [1:first]
mis.insert(make_pair(2, "second")); mis.insert(make_pair(3, "third")); print(mis); output: [1:first, 2:second, 3:third]
map<int,vector<int> > mivi; print(mivi); output: []
mivi.insert(make_pair(1, vi)); print(mivi); output: [1:[1,2,3]]
mivi.insert(make_pair(2, vi)); mivi.insert(make_pair(3, vi)); print(mivi); output: [1:[1,2,3], 2:[1,2,3], 3:[1,2,3]]
vector<string> vs; vs.push_back("first"); vs.push_back("sec,ond"); vs.push_back("th\"ird");
print(vs, HTMLListFormatter()); output: <ul> <li>first <li>sec,ond <li>th"ird </ul>
Note: Does not deal with line breaks in strings. print(vs, CSVFormatter()); output: first,"sec,ond","th""ird"