Skip to content
Open
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
More coverage fixes and small typo fix
  • Loading branch information
BobbyHenrik committed Jan 20, 2020
commit 1a98ec4fa7fdbfab929d1de0c0677c0155b7edcd
23 changes: 22 additions & 1 deletion tests/Statement_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ TEST(Statement, bindNoCopyByName)
const std::string txt2 = "sec\0nd2";
const unsigned char blob[] = { 'b','l','\0','b','2' };
insert.bindNoCopy(atxt1, txt1);
insert.bindNoCopy(atxt2, txt2.c_str(), static_cast<int>(atxt2.size()));
insert.bindNoCopy(atxt2, txt2.c_str(), static_cast<int>(txt2.size()));
insert.bindNoCopy(ablob, blob, sizeof(blob));
EXPECT_EQ(1, insert.exec());
EXPECT_EQ(2, db.getLastInsertRowid());
Expand All @@ -746,6 +746,27 @@ TEST(Statement, bindNoCopyByName)
EXPECT_EQ(0, memcmp(&txt2[0], &query.getColumn(2).getString()[0], txt2.size()));
EXPECT_EQ(0, memcmp(blob, &query.getColumn(3).getString()[0], sizeof(blob)));
}

insert.reset();
query.reset();

// Insert a third row with some more variants of bindNoCopy() using std::string names
{
const std::string atxt1 = "@txt1";
const std::string txt1 = "fir\0st";
insert.bindNoCopy(atxt1, txt1);
EXPECT_EQ(1, insert.exec());
EXPECT_EQ(3, db.getLastInsertRowid());
EXPECT_EQ(SQLITE_DONE, db.getErrorCode());

// Check the result
query.executeStep(); // pass on the first row
query.executeStep(); // pass on the second row as well
query.executeStep();
EXPECT_TRUE(query.hasRow());
EXPECT_FALSE(query.isDone());
EXPECT_EQ(txt1, query.getColumn(1).getString());
}
}

TEST(Statement, isColumnNull)
Expand Down