Skip to content

Commit 3079eaf

Browse files
committed
update and fix testcases
1 parent ece800f commit 3079eaf

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

tests/boost_optional.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ void insert(database& db, bool is_null) {
1616
}
1717

1818
void select(database& db, bool should_be_null) {
19-
db << "select id,val from test" >> [&](long long id, boost::optional<int> val) {
20-
id = id;
19+
db << "select id,val from test" >> [&](long long, boost::optional<int> val) {
2120
if(should_be_null) {
2221
if(val) exit(EXIT_FAILURE);
2322
} else {

tests/nullptr_uniqueptr.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ int main() {
2121
}
2222

2323
cout << "age:" << *age_p << " name:" << *name_p << " img:";
24-
for(auto i : *img_p) cout << i << ","; cout << endl;
24+
for(auto i : *img_p)
25+
cout << i << ",";
26+
cout << endl;
2527
};
2628

2729
db << "select age,name,img from tbl where id = 2" >> [](unique_ptr<int> age_p, unique_ptr<string> name_p, unique_ptr<vector<int>> img_p) {

tests/readme_example.cc

+6-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main() {
3030
<< u"bob"
3131
<< 83.25;
3232

33-
int age = 21;
33+
int age = 22;
3434
float weight = 68.5;
3535
string name = "jack";
3636
db << u"insert into user (age,name,weight) values (?,?,?);" // utf16 query string
@@ -43,9 +43,11 @@ int main() {
4343
// slects from user table on a condition ( age > 18 ) and executes
4444
// the lambda for each row returned .
4545
db << "select age,name,weight from user where age > ? ;"
46-
<< 18
47-
>> [&](int age, string name, double weight) {
48-
cout << age << ' ' << name << ' ' << weight << endl;
46+
<< 21
47+
>> [&](int _age, string _name, double _weight) {
48+
if(_age != age || _name != name)
49+
exit(EXIT_FAILURE);
50+
cout << _age << ' ' << _name << ' ' << _weight << endl;
4951
};
5052

5153
// selects the count(*) from user table

0 commit comments

Comments
 (0)